Re: To Discuss: Application Startup Time

On Sat, 2004-03-27 at 18:13, Andy Ross wrote:
> Soeren Sandmann wrote:
> > Andy Ross wrote:
> > > It's slow because it spends time walking through a zillion icon
> > > directories at a dozen resolutions and stating every file it sees
> > > (via getdents()).  I see 500+ directory opens, with maybe a few
> > > dozen files in each.  That's going to thrash an awful lot of disk
> > > sectors.
> >
> > Yeah, it does look like you are right about this. Maybe some sort of
> > caching could be added to the icon theme spec, like the fontconfig
> > one.
> Actually, I gave this a little more thought.  This is probably
> happening because the library author was actually trying to improve
> performance by building an in-memory cache of all the icons for future
> use.
> The problem is that as things developed, the number of icon files in
> the filesystem outnumbers the number of files actually loaded by a
> typical application by several orders of magnitude.  Simply building
> the "cache" is now *slower* than linearly searching the directories
> for the appropriate files.

That might be possible, however, the stat would happen each time one
looks up an icon, something which happens a whole lot in for instance a
file manager.

> I'd suggest the initial work just eliminate the giant directory
> crawl, and simply do something like:
>   stat("/first/path/to/search/my-icon");
>   stat("/second/path/to/search/my-icon");
>   stat("/third/path/to/search/my-icon");
>   ...
> ...until it finds the file.  This is what bash does when searching the
> PATH for executables, and I've never heard complaints.  This would
> provide an immediate speedup without the need for any annoying on-disk
> indexing.  The index idea could be revived if this was still too slow.

Yes. But bash only does it once, and only on direct user input where a
few stats are not visible. Do the stats a few thousand times when
reading a directory and you'll slow the desktop down to a crawl.

However, maybe we could populate the caches as needed when doing the
stats. It'd be slower than the readdirs() if an app needs all icons, but
might be better if you only use a few of them. Needs some testing.

 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's an underprivileged bohemian rock star from the 'hood. She's an artistic 
extravagent mechanic from a family of eight older brothers. They fight crime! 

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]