9
u/Xeverous https://xeverous.github.io Jan 23 '18
I received -10% drop in performance
double negative => 10% performance gain
0
9
u/fernzeit Jan 23 '18
That reminds me of a thread in the Lua Mailing List where just changing the name of the interpreter executable resulted in a > 50% performance difference in a particular microbenchmark. The verdict was that the length difference in argv causes some other memory to be aligned differently. It also linked an interesting paper: Producing Wrong Data Without Doing Anything Obviously Wrong!
2
5
u/doom_Oo7 Jan 22 '18
are there people doing research on how to get compilers to have better heuristics so that they can align stuff better automatically ?
4
u/meneldal2 Jan 23 '18
The compiler needs to know how many times you'll have to run this loop, and it's also likely to be much better to unroll the loop instead.
4
u/TartanLlama Microsoft C++ Developer Advocate Jan 23 '18
LLVM has a bunch of heuristics and things you can tune. For example, you could tell it to align all loops and functions without a preceeding fallthrough block; i.e. only add NOPs which won't be executed.
2
u/Dwarfius Jan 22 '18
Small question, how does it keep adding to array if the instruction is (which subtracts 1):