https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67435
--- Comment #6 from Yann Collet <yann.collet.73 at gmail dot com> --- The issue seems in fact related to _instruction alignment_. More precisely, to alignment of some critical loop. That's basically why adding some code in the file would just "pushes" some other code into another position, potentially into a less favorable path (hence the appearance of "random impact"). The following GCC command saved the day : -falign-loops=32 Note that -falign-loops=16 doesn't work. I'm suspecting it might be the default value, but can't be sure. I'm also suspecting that -falign-loops=32 is primarily useful for Broadwell cpu. Now, the problem is, `-falign-loops=32` is a gcc-only command line parameter. It seems not possible to apply this optimization from within the source file, such as using : #pragma GCC optimize ("align-loops=32") or the function targeted : __attribute__((optimize("align-loops=32"))) None of these alternatives does work.