That's the point :)
-
-
Replying to @puffybsd
It doesn't get optimized away in real code tho, so what are the benchmarks for?
2 replies 0 retweets 0 likes -
Replying to @CryZe107
Not following... raindrops exercise from exercism.io is a fizzbuzz problem. It's remainder of 3, 5 and/or 7 (non-2^n constant in HD). This would be optimized away in real code too, as this is an optimization the compiler performs. Benches are for fun, as is looking as --emit asm.
1 reply 0 retweets 0 likes -
You're literally benchmarking an empty function. You're never using the result of your rem calls, so the compiler optimizes it away. You need to return the value or use `test::black_box`.
1 reply 0 retweets 0 likes -
https://gist.github.com/sgrif/979b36a145c93a5c6cc67296dc4f0a49 … will actually benchmark the functions for an unknown value of `n` (and you'll see that the builtin mod3 is faster than remu3)
1 reply 0 retweets 1 like -
that's awesome. thanks. Still have a lot to learn. Here's a test run with your functions, also an attempt to introduce some randomness as well. Results still look the same - thoughts?pic.twitter.com/S17MlwdmPQ
2 replies 0 retweets 0 likes -
Last time I tried, I needed to blackbox my output too
1 reply 0 retweets 1 like -
since LLVM can also proof that no matter what n is, there are no side effects and the output is not used
2 replies 0 retweets 1 like -
The output is used if you're returning it to Bencher::iter.
1 reply 0 retweets 0 likes -
weird, I did that before and it wasn't enough
1 reply 0 retweets 0 likes
Y'all are probably also running this on machines fast enough that it's <0.5ns/iter. On my machine it's 1ns and 2ns respectively
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.