Skip to content
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

add hash(Integer) fast-path #49998

Closed

Conversation

oscardssmith
Copy link
Member

Previously this used the hash(Real) path which is a bunch slower since the decomposition needs a lot more normalization and the conditions for when the fast-paths were applicable were more complicated.

# Before
@btime hash(x, UInt(1234)) setup=(x=Int128(rand(Int)))
 12.390 ns (0 allocations: 0 bytes)

julia> @btime hash(x, UInt(1234)) setup=(x=rand(Int128))
 23.768 ns (0 allocations: 0 bytes)

#After
julia> @btime hash(x, UInt(1234)) setup=(x=Int128(rand(Int)))
 5.039 ns (0 allocations: 0 bytes)

julia> @btime hash(x, UInt(1234)) setup=(x=rand(Int128))
 17.538 ns (0 allocations: 0 bytes)

@oscardssmith
Copy link
Member Author

Closing since #49996 gets the same performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant