How inlined are inlined functions?
Alexandre Oliva
oliva@lsd.ic.unicamp.br
Fri Dec 31 23:54:00 GMT 1999
On Dec 3, 1999, Anjul Srivastava <anjul.srivastava@sanchez.com> wrote:
> Imagine my embarrassment when I find that inline functions execute SEVERAL
> times slower than macros.
Maybe it is just that I was lucky, but a few semesters ago I was
taking a course on graphs and I made very heavy use of STL and C++
templates with inline methods in the code. I had a fortunate surprise
when I looked at the code generated by g++ (egcs 1.1, at that time):
absolutely everything that could have been inlined was, and this means
a whole lot of code, since no virtual dispatch was involved. The
main() function contained the code of the whole program, except for
some calls to STL allocators that would make little sense to inline.
And the code quality was *really* good.
But the target architecture was `sparc', which might explain
something...
--
Alexandre Oliva http://www.ic.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{lsd.ic.unicamp.br,guarana.{org,com}} aoliva@{acm,computer}.org
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them
More information about the Gcc
mailing list