From kde-devel Thu May 27 08:30:15 1999 From: Waldo Bastian Date: Thu, 27 May 1999 08:30:15 +0000 To: kde-devel Subject: Inlined code X-MARC-Message: https://marc.info/?l=kde-devel&m=92779330519112 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