Replacing QRegExp with CMake RegularExpression

Matt Rogers mattr at kde.org
Mon Nov 3 02:22:45 UTC 2008


On Sunday 02 November 2008 15:42:57 Robert Knight wrote:
> Hi,
>
> > That's an impressive difference.
>
> Assuming you're testing with an optimized build of Qt that difference
> surprises me, what is taking the extra time in QRegExp?
>
> Regards,
> Robert.
>
> 2008/11/2 M Breugelmans <mbr.nxi at gmail.com>:
> > On Sun, Nov 2, 2008 at 2:59 AM, Andreas Pakulat <apaku at gmx.de> 
wrote:
> >> Hi,
> >>
> >> so I thought it might be interesting to try this out. Turned out to be a
> >> bit more complex than I initially thought and unfortunately it also
> >> introduces one regression with the kde4addunittest test. (I'm seeing an
> >> error message from RegularExpression about nested "*?+", so that 
might
> >> be a hint).
> >
> > Weird, that test still runs fine for me after applying your patch.
> >
> >> Having done a quick time kdevelop like test the startup speed of
> >> kdevelop including loading of kdevplatform was reduced frmo 15 to 11
> >> seconds on my old machine.
> >
> > That's an impressive difference.
> >
> >> The patch is attached for anyone to look at, whats a bit scary is the
> >> conversion between QString and char* for the RegularExpression class.
> >> I'm actually thinking about seeing wether converting to QChar helps 
with
> >> that or wether using that class drains performance again.
> >
> > Constructing RE's is typically expensive, depending on the pattern it
> > can cost as much as a search. QRegExp actually caches compiled RE's
> > behind the scenes (it's #if-deffed though, I did not check if it's
> > enabled), but the cmake one for sure doesn't.
> >
> > Next to the performance gain using kitware's implementation would
> > guarantee 100% identical behavior.
> >
> >
> > Manuel
> >

memcpy for one, since it's called nearly 31 million times while parsing the 
KDevelop CMakeLists.txt hierarchy.
-- 
Matt




More information about the KDevelop-devel mailing list