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

List:       kde-core-devel
Subject:    Re: faster kconfig
From:       Stephan Kulow <coolo () kde ! org>
Date:       2001-02-27 19:35:49
[Download RAW message or body]

aleXXX wrote:
> 
> On Tuesday 27 February 2001 12:17, Harri Porten wrote:
> > 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.
> 
> I think I had a look at the code and size() simply returns an int, without
> iterating.
It would have suprised me if size really called strlen or something.
AFAIK
QCString is QArray<char> and this should have a fixed size

Greetings, Stephan

-- 
People in cars cause accidents. Accidents in cars cause people.

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

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