Fix fixed benchmark#143
Conversation
|
|
||
| // Doubles drawn uniformly from zmij's fixed-notation decimal-exponent range, | ||
| // dec_exp in [-4, 15]: each decade is equally weighted, so the negative- | ||
| // exponent side (which canada.json doesn't cover) gets ~25% of samples. Signs |
There was a problem hiding this comment.
well, yes. I guess that is counting -4 to -0 vs 1 to 15, but that would also not make sense. Will correct
There was a problem hiding this comment.
That's minor, so I can fix it in a follow-up commit. Just wanted to confirm.
|
Thanks for the PR! Mostly looks good but how different are the results between this benchmark and canada? |
|
Right, I had prepared the numbers but didn't include them when writing the PR. The two benchmarks aren't very different with gcc, but surprisingly with clang fixed-range benchmarks significantly faster, e.g. on my Zen4 with the version in the pull request:
(v1 = SSE2, v2 = SSE 4.2) I mainly included it to prevent myself from accidentally pessimizing the negative exponent case. Dragonbox shows us that this is possible. PS here are the numbers with the changes from the other #137 patch. I made a few more runs and couldn't repeat the g++v2 fixed_range regression, but I'm not going to tamper with the numbers.
|
Separates out the fixed benchmark added in #137 as requested in review (a long time ago, I had to recover from trying to use AI to find actual improvements and not hallucinated improvements).
Unlike the existing canada benchmark, this benchmark exercises the full exponential range of the fixed format output. The code path for negative exponents is different in that zeros are prefixed and the decimal point isn't inserted inside the digit string. This benchmark ensures that that variant is also exercised.
This uses an equidistribution of exponents and equidistributes the numbers in the range of each exponent. One change relative to the version in #137 is that I also added 50/50 randomness to the sign.