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

List:       kde-devel
Subject:    Inlined code
From:       Waldo Bastian <bastian () ens ! ascom ! ch>
Date:       1999-05-27 8:30:15
[Download RAW message or body]

pbrown@redhat.com wrote:
> 
> On Thu, 27 May 1999, David Faure wrote:
> 
> > > Modified Files:
> > >     kconfig.h
> > > Log Message:
> > > hasKey() returns false if the key's value is null.
> >
> > Does it have to be inline ?
> > This commit forces full kdebase recompilation (I know, it's not the only one those
> > days !) but that's nonsense as the API isn't changed.
> > Such a big method being inline is a waste of memory isn't it ?
> 
> It gets used a lot.  I don't know, what's the rule of thumb here?  I
> inlined all the functions that get used a lot when I redid KConfig.  I am
> sure it increased code size, but I thought it was the right thing to do.
> Maybe not, I can't be sure.  Opinions?

Some rule of thumbs:

* Use inline for simple setXXXX/getXXXX-like functions only.
* If code has a performance problem and profiling _shows_ that
  inlining a function improves the performance significantly, 
  inline the function.
* Never assume that something will improve performance without
  actually measuring it.

Basically you want to reduce the use of inline functions as much
as possible because:

* it will increase compile-times 
(everyone including the header-file has to compile the inline-
functions),
* you need to recompile a lot if a change is made in the 
implementation and 
* it might increase memory usage.

The above rules of thumb try to balance these disadvantages 
against the advantages (faster execution).

Cheers,
Waldo Bastian
bastian@kde.org

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

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