D pointers

Alexander Neundorf neundorf at kde.org
Fri Sep 30 17:27:38 BST 2005


Hi,

On Friday 30 September 2005 17:46, Lubos Lunak wrote:
...
> think of, says there are about 350 inlines in kdecore. And actually the
> dynamic linker is not that bad these days, from LD_DEBUG=statistics about
> 0,13s (2GHz machine) is spent on that for KWrite. So with 500MHz machine
> turning all those inlines into non-inlines will increase the cost from 0,6s
> to ... uhm ... some maths, guesses and being pessimistic ... 0,8s . Big
> deal.  And this is the guy often working on optimizations saying this.

To be honest, 0.13 s on a 2 GHz machine is a lot of time. Everything which 
takes longer than 0.1 or maybe 0.2 seconds to start feels slow. If this time 
is already spent in the linker there is no chance a KDE application could 
ever startup fast.
Also an increase from 0.6 s to 0.8 s would be a lot of time, it would be 33 % 
more. When I was trying to optimize konsole startup, initially it was about 
320 ms on a 200 MHz box. I was able to get the time down to something like 
180 ms, i.e. 140 ms seconds saved. These 100 ms really made a difference, it 
felt noticeably faster. 
malloc()'s are expensive. In code which gets executed very often they really 
should be avoided. Widget creation is no such case. (Ok, when the application 
starts all widgets are created at once, so then this should be fast too).
Working with QStrings is such a case. And I never suspected that KURL would be 
a "slow" class, but as I learned it seems KURL might be also such a case.

There are some (more or less ugly) ways to get away without malloc(), like 
using pools or adding some (fixed) space for future extensions. In 
performance critical cases such things might be considered.

Bye
Alex
-- 
Work: alexander.neundorf at jenoptik.com - http://www.jenoptik-los.de
Home: neundorf at kde.org                - http://www.kde.org
      alex at neundorf.net               - http://www.neundorf.net




More information about the kde-core-devel mailing list