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

optimize Divider.mixedness #441

Merged
merged 5 commits into from
Jul 9, 2023
Merged

optimize Divider.mixedness #441

merged 5 commits into from
Jul 9, 2023

Conversation

niklasf
Copy link
Member

@niklasf niklasf commented Jul 9, 2023

Before:

[info] PlayBench.divider  thrpt   45  21.868 ± 1.357  ops/s

After, first attempt:

[info] PlayBench.divider  thrpt   45  33.767 ± 1.497  ops/s

Additionally, precomputing mixedness regions again:

[info] PlayBench.divider  thrpt   45  51.566 ± 4.220  ops/s

Additionally, using mapReduce:

[info] PlayBench.divider  thrpt   45  65.580 ± 3.128  ops/s

Additionally, using Long instead of Bitboard region masks:

[info] PlayBench.divider  thrpt   45  91.231 ± 5.867  ops/s

Copy link
Member

@lenguyenthanh lenguyenthanh left a comment

Choose a reason for hiding this comment

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

This is really nice, thanks Niklas. I was thinking to do the same but too scared. Just added small suggestion, otherwise LGTM.

src/main/scala/Divider.scala Show resolved Hide resolved
@niklasf
Copy link
Member Author

niklasf commented Jul 9, 2023

Switching from Bitboard to Long for the region masks is (to me) a surprisingly large win:

[info] PlayBench.divider  thrpt   45  91.231 ± 5.867  ops/s

@lenguyenthanh
Copy link
Member

lenguyenthanh commented Jul 9, 2023

I didn't expect that big of improvement either. It makes me wondering how much we can gain if we don't use Bitboard abstraction.

@lenguyenthanh
Copy link
Member

lenguyenthanh commented Jul 9, 2023

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 ornicar merged commit ee603c0 into master Jul 9, 2023
2 checks passed
@lenguyenthanh lenguyenthanh deleted the optimize-mixedness branch July 9, 2023 10:24
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.

3 participants