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

Prime benchmark radix tries use hash maps #364

Open
Snektron opened this issue Sep 18, 2021 · 1 comment
Open

Prime benchmark radix tries use hash maps #364

Snektron opened this issue Sep 18, 2021 · 1 comment

Comments

@Snektron
Copy link

Each node in the radix tries should have at most 10 children. In this scenario, a hash map often adds overhead compared to using a simple 10-element array. For example, i was able to reduce the runtime of the Zig implementation from 67 to 42 ms on my machine, and i suspect similar improvements are possible for the other compiled languages.

@nuald
Copy link
Collaborator

nuald commented Sep 18, 2021

Agreed, but if we change one implementation, the similar changes should be implemented for all other tests. Also please note that we don't have a goal to create the fastest prime numbers generator, but rather to compare performance of the similar functionality between different languages. It's quite tough and unfair task already, and micro-optimizations could make it even more tougher and more unfair. For example, PHP arrays are internally all hashmaps regardless of how they used (as vectors or as associative arrays), so the change like that won't affect its performance.

Nevertheless, I'd accept the PR with changes (if all tests are addressed).

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

2 participants