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

List:       kde-core-devel
Subject:    Re: faster kconfig
From:       Harri Porten <harri () trolltech ! com>
Date:       2001-02-27 11:17:39
[Download RAW message or body]

aleXXX wrote:
> 
> Hi,
> 
> I tried the following in kconfigdata.h but it didn't work correctly, suddenly
> no icons where loaded anymore, I don't know why. I recompiled only libkdecore.
> The two added lines would save again some thousands qstrcmps() on startup for
> the most simply KDE 2 app and keep a unambigous order for the used QMap.
> Maybe it would have been enough to recompile some other stuff too, I don't
> know.
> 
> inline bool operator <(const KEntryKey &k1, const KEntryKey &k2)
> {
> +   if (k1.mGroup.size()!=k2.mGroup.size())
> +      return (k1.mGroup.size()<k2.mGroup.size());
> 
>    register int result=qstrcmp(k1.mGroup.data(),k2.mGroup.data());

It might save you strcmp() calls but have you measured how much the
resulting code is actually faster ? After all the QCString::size() calls
will have to iterate through every character as well. A regular strcmp()
implementation should abort on the first mismatched character, shouldn't
it ?

Harri.

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

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