This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: On inlining in C++


Joe Buck wrote:
For -O3, try what you want, and maybe I could recommend its use someday,
but not for 3.2 or 3.3 and C++.  For evidence why, I suggest looking at a
recent speed comparison between Gentoo and Debian versions of a number of
apps: why did Gentoo come out slower despite its custom optimizations?  My
theory: -O3.

I ran into precisely the behavior you describe above: -O3 produces slower code than -O2 in several cases.


For example, on my C benchmark of Huffman compression (lots of bit manipulations and small loops), run on a 2.8GHz Pentium 4 hardware with gcc 3.2.2:

options  time (secs)
-------  -----------
n/a      44.4
-Os      28.4
-O1      26.3
-O2      30.2
-O3      30.7

Using -funroll-all-loops and other options can bring the run-time down to under 24 seconds. I'm still investigating how various "inline" settings affect the outcome; on preliminary tests, -finline-functions is definitely a loser.

I've been distracted by paying work (silly me!), but I'll try to get my results into coherent form in the coming days. I probably need to run tests for GCC 3.4, too...

--
Scott Robert Ladd
Coyote Gulch Productions (http://www.coyotegulch.com)
Software Invention for High-Performance Computing


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]