-
Notifications
You must be signed in to change notification settings - Fork 13
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
performance issue #15
Comments
I get similar results on my work computer (Ubuntu 16.04, i7-8700k)
|
The problem seems to be a mix between inlining and const evaluation. I have produced a patch with the following benchmarks:
PR and a couple of new issues inc |
So it looks like @phil-opp already have fixed half the problem (const stuff) in #13 The other half of the problem is that rust will not inline stuff between crate boundaries unless functions are marked with After #13 and #16 is addressed i will suggest inlining relevant methods in BitField and BitArray. |
Thanks for reporting and investigating! Seems like we should mark the relevant functions with |
Here are the benchmarks:
|
Good job! Now the result on my benchmark: running 4 tests
test get_bitfield ... bench: 686 ns/iter (+/- 48)
test get_trivial ... bench: 672 ns/iter (+/- 45)
test set_bitfield ... bench: 2,716 ns/iter (+/- 66)
test set_trivial ... bench: 2,787 ns/iter (+/- 263) |
Awesome, thanks so much for your work @kjetilkjeka! Seems like we can close this issue then. It would be great these benchmarks to the repository. Would you be willing to open a pull request, @huwsun? (I also like the idea of adding a CI test that fails on huge regressions like proposed in #17, but we can always to this in a follow up PR.) |
Hi,On my mac book pro (8c 16g), the library has a large performance difference compared to the code I manually implement.
I read the library implementation code, logically it should be the same, but why is there such a big difference in performance?
I didn't read all the library code carefully, could you please give me some advice on whether my test method is wrong or the code of the library itself?
rustc 1.27.0-nightly,the bench result:
my trivial code and bench code:
The text was updated successfully, but these errors were encountered: