[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Reducing the number of conflicts in libraries
From:       Guillaume Laurent <glaurent () telegraph-road ! org>
Date:       2001-09-27 15:48:44
[Download RAW message or body]

On Thursday 27 September 2001 17:27, Harri Porten wrote:
> On Mon, 17 Sep 2001, Lubos Lunak wrote:
> >  If you look in qvaluelist.h, you'll notice that all template classes
> > in this header file have their methods implemented in the class body,
> > which automatically makes them inline, even if they aren't explicitly
> > marked so. Some of the methods are quite large and this causes larger
> > executables. Moreover gcc won't inline some of them (compile with
> > -Winline to see),
>
> I didn't get any of these warnings. Strange. Did you have a lower limit
> set ?

As far as I know, Lubos is right. I'm looking at qvaluelist.h and I'm pretty 
sure you'd get a very significant benefit by moving the implementations out 
of the body.

> I was told that gcc < 3.0 doesn't do any automatic inlining of template
> member functions at all so one has to be very carefull with a redesign.

As some point with Gtk-- we tried to inline most of our code, since it was 
essentially single-line methods. The library size almost doubled. That was 
with g++ 2.9 I think.

Another thing is, inlining in templates can easily become a performance 
killer because due to the expansion of templates within templates etc... you 
can get fully expanded methods which won't fit in your CPU cache anymore.

-- 
Guillaume
http://www.telegraph-road.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic