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 using fixed-size bitsets for terminal sets #1

Open
osa1 opened this issue May 15, 2021 · 0 comments
Open

Consider using fixed-size bitsets for terminal sets #1

osa1 opened this issue May 15, 2021 · 0 comments

Comments

@osa1
Copy link
Owner

osa1 commented May 15, 2021

We currently use FxHashSet for terminal sets in first and follow sets, but we could use fixed-size bitsets instead. I have an implementation in refactor_terminal_sets but it doesn't make much difference: a benchmark runs in 4.9s instead of 5.0s. I think part of the reason is because these sets are usually tiny, perhaps with 3-4 elements at most, so it doesn't matter what we use.

I also have a bitset implementation in smol_bitset repo. It uses a single word for bitsets smaller than 63 elements. For larger, it falls back to heap allocated word array. However, when I replace the bitset in refactor_terminal_sets branch with smol_bitset it literally made no difference in the benchmark.

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

No branches or pull requests

1 participant