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

dispatch operation on LongLongUInt{1} to UInt #56

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

ArrogantGao
Copy link
Contributor

Operations on LongLongUInt{1} is slower that directly use operation on Uint, dispatch them to functions of UInt.
Now the performance is shown below:

julia> using BitBasis, BenchmarkTools

julia> b1 = bmask(LongLongUInt{1}, 1:10)
LongLongUInt{1}((0x00000000000003ff,))

julia> b2 = bmask(UInt, 1:10)
0x00000000000003ff

julia> @btime $b1 << 1
  1.375 ns (0 allocations: 0 bytes)
LongLongUInt{1}((0x00000000000007fe,))

julia> @btime $b2 << 1
  1.375 ns (0 allocations: 0 bytes)
0x00000000000007fe

julia> @btime readbit($b1, 10)
  1.375 ns (0 allocations: 0 bytes)
0x0000000000000001

julia> @btime readbit($b2, 10)
  1.375 ns (0 allocations: 0 bytes)
0x0000000000000001

@ArrogantGao
Copy link
Contributor Author

I also defined the isless function for the LongLongUInt type, so that now we can compare and sort them.

julia> b3 = LongLongUInt{1}(3)
LongLongUInt{1}((0x0000000000000003,))

julia> b4 = LongLongUInt{1}(4)
LongLongUInt{1}((0x0000000000000004,))

julia> b3 < b4
true

julia> sort([b3, b4, b3])
3-element Vector{LongLongUInt{1}}:
 LongLongUInt{1}((0x0000000000000003,))
 LongLongUInt{1}((0x0000000000000003,))
 LongLongUInt{1}((0x0000000000000004,))

Copy link
Member

@GiggleLiu GiggleLiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@GiggleLiu GiggleLiu merged commit 241d6a8 into QuantumBFS:master Aug 13, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants