LZ4 Compiler Optimization Flags

101 views
Skip to first unread message

Shawn

unread,
Apr 19, 2018, 12:11:05 PM4/19/18
to LZ4c
I have been testing using the fullbench executable in the tests directory, and changed around the -O3 flag in the Makefile to -O2. I noticed that after testing both flags a few times, the -O2 flag was consistently faster then the -O3 flag by around 5%. Is there any specific reason for the -O3 flag being called instead of the -O2 flags?

Cyan

unread,
Apr 19, 2018, 2:01:59 PM4/19/18
to LZ4c
It used to be that -O3 produced significantly faster binaries than -O2.
It changed a few versions ago,
both as a consequence of source code modifications, which are friendlier to compiler's optimizations,
and as a consequence of compiler's improvements.

Note though that this result (-O2 faster than -O3) is not a sure outcome.
You will find that such difference vary, depending on compiler type and version.

If I do remember correctly, I considered switching to -O2 a while ago,
but shelved the idea after finding a few configurations in which -O2 was actually slower.

I'm likely to reconsider it in the future.
Reply all
Reply to author
Forward
0 new messages