|« Include What You Use - Yet a new cool tool in Debian.||Clang 3.3 and Debian »|
About optimization flags in software
Following a thread on the Clang mailing list, I did a quick analysis of the optimization flags used to build C or C++ code.
I used a rebuild result from last mid July of all Debian native packages (meaning that I don't have the log of full Java, Python or other packages without native code) and wrote a small script to count all their occurrences.
By default, deb packages uses the command "dpkg-buildflags --get CFLAGS" which will set the optimization level to -O2. However, many packages and upstream build systems do not respect such flags.
On 10320 binary-only packages (in total, Debian has around 19000), the results are the following:
|Optimization level||Number of occurrences||Number of packages|
Since a graphic talks more than numbers (note that the Y axis is logarithmic):
Some packages are using several optimization flags during the same build.
Some packages are not showing the full command line (see jessie release goal: verbose build logs)
The results might be approximate since I am basically grepping "-OX " on the log files.