Skip to content

fix: prefer std::nearbyint over std::round to avoid gcc 10 perf regression

Christoph Hasse requested to merge chasse_fix_gcc10_perf_regression into master

What a nice 🐇 🕳 to jump into 🙈

Especially since I could have saved a lot of time if only I remembered !1856 (merged) 🤦
We really should be adding std::round to the list of things we should flag in code review.

Local tests show a slight difference in counters, which is expected as the rounding behavior is a bit different.
Why didn't we run into this problem with gcc9 ?! Well, I can't find a single mention of round when looking at the .so with objdump.
No idea what smart tricks gcc9 played, but the .so from gcc10 had the round functions, so that's why we started paying for them.

fyi: @clemenci @cmarinbe @decianm @jonrob @rmatev @gligorov

Merge request reports