http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53316

--- Comment #10 from David Stone <david at doublewise dot net> 2012-05-16 
15:57:13 UTC ---
I did some research to see how often each optimization level is actually used.
Looking solely at the most followed C and C++ repositories on github, I
collected the following data:

C:

Linux kernel: 2 s
redis: 2 0
vim: 2 6 0 (6 and 0 for commented out options that are selectively enabled for
testing)
git: 2 s 0 (s for debugging, 0 for code coverage tests)
PHP: 0 2 s
openFrameworks: s
memcached: no defaults found (somewhat thorough check, autotools)
libfreenect: 2
xbmc: 2
mruby: 3 (even for debugging!)
wax: no defaults found (rake)
beanstalkd: use the default 0 (implicit, Make)
ccv: 1 (but they preceed it with CC = clang, so it's not really relevant for
us)
yajl-ruby: no defaults found (rake)
libgit2: 2 0
iProxy: seems to be XCode only
http-parser: 0 3
nginx_http_push_module: no build scripts, so no defaults


C++:

hiphop-php: 0 3 s
MongoDB: 0 3
Doom GPL: 0 1 3 (0 and 1 are both used with debugging)
PhantomJS: no defaults found (qmake)
MaNGOS: Does not appear to set (thorough check, CMake)
Scribe: 3 0
TrinityCore: Does not appear to set any optimization level, but does turn on
some 'f' flags specifically (CMake)
bitcoin: 2
firesheep: 0
Mosh: 2
farbrausch/fr_public: Written for Visual Studio
twitter/MySQL: 0 3
Cinder: (uses XCode 3.2 on Mac, Visual C++ on Windows)
therubyracer: no defaults found (rake)
wkhtmltopdf: no defaults found (qmake)
v8: 0 3 2 (the 2 seems to be always added after the 3, so I don't know if the 3
is actually ever used)
depthjs: no defaults found (CMake)
node-canvas: 3
libzmq: 0
HandlerSocket: 3



I think it's interesting to note that -O1 only appears a single time, and that
is in the Doom 3 source. -O0 and -O1 are both used for debugging, with -O3 used
for release. -O0 shows up 16 times for sure (plus possibly some implicit -O0),
-O2 shows up 11 times, -O3 shows up 10 times (although I believe it is
overwritten with -O2 in one of them), and -Os shows up 5 times.

-Os is used 4 times in C code compared to just once in C++. However, -O3 is
used 8 times in C++, compared to only twice in C. In general, C projects seem
to prefer -O2, while C++ projects seem to prefer -O3.

I could not find a default optimization setting for 11 out of 34 projects (+ 4
that definitely do not use gcc). Of those 11 projects:

* 1 has no build scripts at all (and thus the default is just whatever the
compiler default is, therefore -O0)
* 2 use qmake, which I believe can be called with something like -release,
which gets -O3, but defaults to -O0 (I'm not sure on this, I don't use qmake)
* 3 use rake, which may set its own defaults (I don't know). I couldn't find a
single default for projects using rake.
* 3 use CMake, which may set its own defaults (I don't know)
* 1 uses a plain Makefile, and I believe I checked everything and could not
find any defaults (so I counted it as -O0)
* 1 uses the auto-tools, and I checked pretty thoroughly and I could not find
any default settings, but there is a slight chance I may have missed it so I
didn't count it as -O0

Reply via email to