Re: To Discuss: Application Startup Time



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.

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.

Andy



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