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

Make nsieve benchmark fair #419

Open
silkskier opened this issue Aug 24, 2023 · 1 comment
Open

Make nsieve benchmark fair #419

silkskier opened this issue Aug 24, 2023 · 1 comment

Comments

@silkskier
Copy link

silkskier commented Aug 24, 2023

Some of the implementations differ enough to make the comparison worthless. The one standing out the most does seem to be Julia's implementation, which stores an array of booleans in order to speed up the computation. After applying Julia's code logic C++ code gets over twice as fast. All tested with Julia 1.9.2 and g++-13

Here are my results (user time only, Ryzen 4600h);

nsieve 10
C++: 121 ms
Julia: 293 ms
C++ with Julia's code structure: 48 ms

nsieve 12
C++: 681 ms
Julia: 466 ms
C++ with Julia's code structure: 243 ms

I have attached my file with the faster C++ code I've used for comparison, however, it looks like many more languages do use a slow implementation instead of a fast one.

3.cpp.txt

@cyrusmsk
Copy link
Contributor

cyrusmsk commented Sep 3, 2023

Nice catch.
But yeah unfortunately not all implementations are using the same algorythms or approaches (with/without SIMD).
Some langs for example have internal bidings to GMP.. which is of course available to the lang developer, but still is external library.
So the main point is in that all values of the benchmarks should be considered as an example and need some detailed comparison, because not all implementations are the same.

HFTrader added a commit to HFTrader/Programming-Language-Benchmarks that referenced this issue Mar 6, 2024
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