From kde-core-devel Sat Aug 25 08:28:43 2001 From: Lubos Lunak Date: Sat, 25 Aug 2001 08:28:43 +0000 To: kde-core-devel Subject: Re: kbuildsycoca and faster KDE startup X-MARC-Message: https://marc.info/?l=kde-core-devel&m=99872822506571 Dne p=E1 24. srpen 2001 22:44 Waldo Bastian napsal(a): > On Friday 24 August 2001 12:58 pm, Lubos Lunak wrote: > > Hello, > > > > could somebody who actually understands KSycoca and all those strang= e > > things like factories and such review this patch ? I have no idea wha= t > > the code does, it just appears to work here :). > > Yes, I understand most of it, having written it and all that :-) > > > The patch should make KDE startup faster by not doing save() in > > kbuildsycoca, when there's actually no need to recreate ksycoca datab= ase > > file. > > Oh very smart. Looks good. I have simplified it a little bit, concept > listed below (it prolly doesn't want to patch in like this). I also not= iced > thanks to your patch that the changeList is empty when there was no > database at all, this version will add all resources to the changeList = in > that case which seems to be slightly more correct. > > KCTimeInfo *ctimeInfo =3D new KCTimeInfo(); > + bool uptodate =3D true; > // For all resources > for( QStringList::ConstIterator it1 =3D allResources.begin(); > it1 !=3D allResources.end(); > @@ -229,18 +232,27 @@ void KBuildSycoca::build(KSycocaEntryLis > { > // Re-use old entry > entry =3D entryDict->find(*it3); > + // remove from ctimeDict; if ctimeDict is not em= pty > + // after all files have been processed, it means > + // some files were removed since last time > + ctimeDict->remove( *it3 ); > } > else if (oldTimestamp) > { > changed =3D true; > kdDebug(7021) << "modified: " << (*it3) << endl; > } > else > { > changed =3D true; > kdDebug(7021) << "new: " << (*it3) << endl; > } > } > + else { > + changed =3D true; > + } > ctimeInfo->addCTime(*it3, timeStamp ); > if (!entry) > { > @@ -257,6 +269,7 @@ void KBuildSycoca::build(KSycocaEntryLis > if (changed) > + { > + uptodate =3D false; > g_changeList->append(resource); > + } > } > + return !uptodate || allEntries =3D=3D NULL || !ctimeDict->isEmpty(); > } > > > If you happen to run SuSE7.2 ( where kbuildsycoca has to process > > 1000+ .desktop files ) on a somewhat slow computer, you'll probably > > notice the difference ( can be several seconds ). > > Any figures? Reading/writing takes about 1s each on my system (SuSE 7.1 > with vanilla KDE) But SuSE7.1 doesn't have those 1000+ .desktop files in /etc/opt/kde2, do= es=20 it ? Here, SuSE7.2 on K6/188 with a rather fast HDD, it's 2 seconds=20 incremental build(), and 4 seconds save(). Non-incremental is even worse,= but=20 that seems to be used only when there's no ksycoca file. Please apply if it's ok now. Lubos Lunak -- l.lunak@email.cz l.lunak@kde.org http://dforce.sh.cvut.cz/~seli