Yesterday I had a really funny and surprising observation.
Playing again a bit with my tiny chess engine (the EGUI tiny-chess version), I added
[profile.dev]
opt-level = 3
to Cargo toml, just to be able to use default debug builds, but still can test the optimized code.
The funny fact was, that now debug build worked significantly faster than all release builds I had seen before. For release builds, it was typically for more than a year that the first reply after e2e4 took 2.5 sec for a base depth of 7 ply. All may tiny optimizations have never significantly changed that. But now the debug build took only 1.9 sec. Of course it is a bit hard to believe, so one might assume just a bug or something like that. But then I found out, that adding
[profile.release]
debug-assertions = true
gives a similar speed increase. While actually significantly increasing executable size.
I know that random performance changes are common. Reasons might be the way and structure how code is loaded into RAM, alignment of code and data and cache, and a lot more.
But still I find this surprising.