-
Notifications
You must be signed in to change notification settings - Fork 377
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
Encourage Hash#compare_by_identity
#189
Comments
marcandre
added a commit
to marcandre/ruby
that referenced
this issue
Dec 23, 2020
Using `compare_by_identity` gives a 4x performance boost on cache hits. Benchmark in fastruby/fast-ruby#189
marcandre
added a commit
to marcandre/ruby
that referenced
this issue
Dec 23, 2020
Using `compare_by_identity` gives a 4x performance boost on cache hits. Benchmark in fastruby/fast-ruby#189
marcandre
added a commit
to marcandre/ruby
that referenced
this issue
Dec 23, 2020
Using `compare_by_identity` gives a 4x performance boost on cache hits. Benchmark in fastruby/fast-ruby#189
marcandre
added a commit
to ruby/ruby
that referenced
this issue
Dec 23, 2020
Using `compare_by_identity` gives a 4x performance boost on cache hits. Benchmark in fastruby/fast-ruby#189
hsbt
pushed a commit
to ruby/psych
that referenced
this issue
Dec 23, 2020
Using `compare_by_identity` gives a 4x performance boost on cache hits. Benchmark in fastruby/fast-ruby#189
Can be optimized... ruby/ruby#3987 |
In Ruby 3.0+, the performance difference will still exist but won't be as noticeable. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If one is using keys that can be compared by identity, and if those keys are not already optimized (symbols are optimized, not sure what else is), using
compare_by_identity
can yield a 4x speedup.Same result if lookup is not successful (as long as the hash is not empty...)
I hope we can optimize this a bit.
The text was updated successfully, but these errors were encountered: