-
-
Notifications
You must be signed in to change notification settings - Fork 217
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
feat(leap): add performance article #760
Conversation
Hej! When I ran the tests on my computer I got significantly different results:
On my computer (with a AMD Ryzen 1920X) I got these results (slightly shortened):
It looks like "boolean_chain" is among the slowest approaches, "boolean_chain_inverse" is significantly faster but "ternary" beats both. That's surprising. Or am I misinterpreting the numbers? |
That is strange. I used I can't change my CPU to performance, as the VM does not support it, but that should not change things so drastically. I reran the tests many times and always got those results. Even with Another go:
|
Finally managed to run benchmarks on my old, slow computer 😉
Looks like on my computer, |
@clechasseur at least chain and inverse chain are in a "sensible" order. What do you and @siebenschlaefer think? Should I add or edit some of the article, or let it stand as it is for my machine? |
@ErikSchierboom have you had diverging benchmarks for an approach article before? |
When I read the different approach documents for the Leap exercise, I wondered whether results could vary depending on how the CPU handles pipelining. The "inverse chain" is an example; on paper, it looks worse because the edge case is checked fist. But what if instructions are reordered in some way? I am wondering whether @siebenschlaefer's results can be explained by the fact that they're using an AMD processor (I am on Intel). I will also admit to not being a fan of such very low-level optimizations in general. Optimizing a method to determine if a year is a leap year seems a bit extreme: is that really the performance bottleneck of your program? Let's say that it's true that the ternary approach is 27% slower; it's 27% of such an infinitesimal amount of time, does it really matter? But I will leave it to you to determine whether the article should be posted: in itself, it seems fine. |
My results are AMD as well.
I should include that into the article. |
Nope, but I've been the only one doing them on my articles :D |
…com/exercism/cpp into feat(leap)--add-performance-article
I think the wording in the article is a good summary of our discussion here @siebenschlaefer @ErikSchierboom. |
Merged. Everyone feel free to do follow ups if appropriate but it's good for us to test this |
To make the links work, this should be merged after #759✔️To make the image work, exercism/images#24 should be merged beforehand. ✔️