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

Consider if we should stop using TotalWrapper for OpaqueBitboard for performance gain #442

Closed
lenguyenthanh opened this issue Jul 9, 2023 · 3 comments

Comments

@lenguyenthanh
Copy link
Member

As demonstrated in #441, we may have a significant gain in performance by switching from Bitboard to Long.

I guess the performance penalty is mostly caused by TotalWrapper because with it, Bitboard is be boxed object , not just a primitive Long anymore.

But maybe the opaque type has some responsibility as well.

@ornicar
Copy link
Collaborator

ornicar commented Jul 9, 2023

do you use this metals command? it might provide some insight

cIfHO00

@lenguyenthanh
Copy link
Member Author

lenguyenthanh commented Jul 9, 2023

yes, I started to use that recently and with async-profiler to understand more about what happen under the hood.
Here is one example I got after running bench-marking with async-profiler.
Screenshot 2023-07-09 at 20 53 29

We can see that, just for Bitboard.contains it required much more than what needed.

I guess scalalib.newtypes are over kill for Bitboard

Maybe some inline for Bitboard.contains can help a bit in this case, but I think, we can have a much bigger gain if we migrated Bitboard from scalalib.newtypes.

@lenguyenthanh
Copy link
Member Author

close with #449

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

No branches or pull requests

2 participants