gcc optimizations

John Richard Moser nigelenki at comcast.net
Sat Sep 30 19:27:29 EDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

It looks like the redundancy analyzer in gcc is broken.  My first hint
was that after 6 hours of work I finally narrowed down some interesting
performance measurements using nbench[1]* to Partial Redundancy
Elimination; my second was popping into #gcc on OFTC and being told the
RA is "stupid" and doesn't work so hot on x86.

It turns out that -O2 turns -ftree-pre on by default, and -Os turns it
off; so certain operations were quite awesomely faster with -Os (and
others slower).  Fiddling with tons of optimizations I eventually
noticed the SAME hit -O2 takes in ONE optimization; I disabled this
during an -O2 compile of nbench and lo and behold the numbers looked a
lot better.

Details on the Wiki at [2].  Somebody should plug some real-world
application into this, like rendering a JPEG image, Web page, or Ogg
Vorbis file and measuring how long this takes in real time using both
'-O2' and '-O2 -fno-tree-pre'.  Some code seems slightly slower, while
most code seems significantly faster.


[1]http://www.tux.org/~mayer/linux/bmark.html
[2]http://wiki.laptop.org/go/User:Bluefoxicy/gcc_optimizations

*nbench is highly CPU intensive, it does no IO benchmarks.  The CPU will
get hot.  I compiled it on a tmpfs mounted on /tmp/x to avoid touching
flash.

- --
All content of all messages exchanged herein are left in the
Public Domain, unless otherwise explicitly stated.

    Creative brains are a valuable, limited resource. They shouldn't be
    wasted on re-inventing the wheel when there are so many fascinating
    new problems waiting out there.
                                                 -- Eric Steven Raymond

    We will enslave their women, eat their children and rape their
    cattle!
                  -- Bosc, Evil alien overlord from the fifth dimension
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIVAwUBRR79XQs1xW0HCTEFAQL2Uw/9G7aNVyFBn6v3kVM9gykqD+vhy89CL7pc
WjjwDJ1YOMlZdsmcW+hrbykCgL7vZYKqFKN6MdK7Z4lM9z5FIfU8QGdAIkWq/N1a
D1f7eJbCuL/FcMxNMmcG+alJDh6RQW6QBmafFtzTsezPkCSovaGTcY0kn85593nV
S+wxOb2N+EwDi0QFkji4U8CM2P6OjrE/1BQkyL2EskWzvHoRuu7HKdwcXWFqIQMc
kxqktyTVTLjJnXuWse1hiPuy7gN+LcTEHTLqUEWBZLUyXa1dr0u1MG4i+JI4xRpM
cE6BUPw27Fg4LcRM2F8nda+cHhjcrRt+xJAAMR/driNQfehFCYXX0GMJEFprH9Zv
HQtHS2wzjmwUu4WjbH4gdiJcIFTVfUpNm3coa8Z/PzBV0oQ5Atv+L3S4qbJZKD0B
2ZdtljBXWPZIDl9CS2g0jF1nVqKH/jszu9grix6Pl4P0rhEz6YE5zRJe5IZaK2q9
aGX5htZqmxRDAFOBU6fYhPs/nk1JrhhBRjqsCsp2v/CEJNxz0+GCMMbcKCOzoHPK
yhDXFbcceCeh83wwIpzYdffrHj3EallIkNcW8I5rvjpOZ9yzatkfxod3+ovRIB6n
ojjH8IuIqliiPjO07NqoxLItJbUn3wPbDBnr7oGojEf7LRL/9Kugulkqk9euVB5g
+nUB5IG65hk=
=Y0Xu
-----END PGP SIGNATURE-----



More information about the Devel mailing list