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

List:       kde-core-devel
Subject:    Re: kbuildsycoca and faster KDE startup
From:       Lubos Lunak <l.lunak () sh ! cvut ! cz>
Date:       2001-08-25 8:28:43
[Download RAW message or body]

Dne pá 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 strange
> > things like factories and such review this patch ? I have no idea what
> > 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 database
> > 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 noticed
> 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 = new KCTimeInfo();
> +  bool uptodate = true;
>    // For all resources
>    for( QStringList::ConstIterator it1 = allResources.begin();
>         it1 != allResources.end();
> @@ -229,18 +232,27 @@ void KBuildSycoca::build(KSycocaEntryLis
>                     {
>                        // Re-use old entry
>                        entry = entryDict->find(*it3);
> +                      // remove from ctimeDict; if ctimeDict is not empty
> +                      // after all files have been processed, it means
> +                      // some files were removed since last time
> +                      ctimeDict->remove( *it3 );
>                     }
>                     else if (oldTimestamp)
>                     {
>                        changed = true;
>                        kdDebug(7021) << "modified: " << (*it3) << endl;
>                     }
>                     else
>                     {
>                        changed = true;
>                        kdDebug(7021) << "new: " << (*it3) << endl;
>                     }
>                 }
> +               else {
> +                   changed = true;
> +               }
>                 ctimeInfo->addCTime(*it3, timeStamp );
>                 if (!entry)
>                 {
> @@ -257,6 +269,7 @@ void KBuildSycoca::build(KSycocaEntryLis
>       if (changed)
> +     {
> +        uptodate = false;
>          g_changeList->append(resource);
> +     }
>    }
> +  return !uptodate || allEntries == 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, does 
it ? Here, SuSE7.2 on K6/188 with a rather fast HDD, it's 2 seconds 
incremental build(), and 4 seconds save(). Non-incremental is even worse, but 
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

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

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