-
Notifications
You must be signed in to change notification settings - Fork 376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hash#update() vs Hash#[]= #195
Hash#update() vs Hash#[]= #195
Conversation
|
||
def slow | ||
ENUM.each_with_object({}) do |e, h| | ||
h.update(e => e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you create an additional Hash object which of curse will be much slower than only provide two "static" parameters as for Hash#[]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree but keeping it similar to its alias Hash#merge!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please guide me, how to go about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well it's obviously slower - i guess that's the whole point of this test?
looks fine to me 🌵
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @krtschmr As a next step can the Travis CI build be run for this PR and if everything looks good could this PR be considered for next release?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i have nothing to say here. i feel this repo is a bit inactive 🤷🏿
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand, can it atleast be merged into the master branch? As its not a breaking change.
Fasterer PR DamirSvrtan/fasterer#92 has a dependency on this one. It would be very helpful if this PR gets merged in. Thanks. |
Hash#update is an alias for Hash#merge!. Ergo, the comparision between Hash#update and Hash#[]= should have similar outcome.
Ref #194