thanks for coming up with these numbers. IMO it's worthwhile to look
at GIMP startup time and see if we can improve things there. I have an
idea that might help in this regard and motivated by your mail, I
think I should try to present it here...

Quite some time seems to be spent reading in data files like brushes,
palettes, patterns, gradients, fonts. This gets worse if you start to
add more than what comes with a default GIMP installation. So it seems
that there's some potential for optimization here. Except for fonts
which are handled somewhat differently, the data types I mentioned all
all derived from a common base class, GimpData. So we should be able
to improve things a lot if we can improve how GimpData loads it's

Or when. There is actually no good reason to load all brushes on
startup, nor all palettes, patterns,... Actually it's more like a
waste of resources to load them all into memory. People would probably
install a lot more data files if that wouldn't make GIMP heavier and
slow down startup.

But as soon as more data files are being added to GIMP, another
problem starts to show up. The lack of categories makes it difficult
to handle large amounts of brushes, palettes, patterns, gradients,
fonts. At some point the list just becomes too long. Now this problem
could be addressed at the same time...

So here's the proposal:

Similar to how plug-ins are cached in pluginrc, we could cache
information about our data files. The brushrc would contain a list of
all brushes. For each brush we would store name, size, filename and
file modification time. Each data item also has a list of categories
it belongs to. The GimpDataEditor can then use this info to group
brushes into folders (see bug #119874). What's missing is a preview of
the brush to use for example in the brush dialog.

Now if there was a PNG thumbnail for each data file, we could read
that image instead. For large brushes and especially for animated
brushes, this should be an improvement. For small brushes it would add
an overhead though. If we have to read a 1000 thumbnail files instead
of a 1000 brush files, that wouldn't improve things at all. However if
we put all brush thumbnails into a single file, that should load
rather fast.  We could then even mmap the file at startup and delay
reading the preview to the point where it is actually needed.

This would reduce data loading at startup to parsing a couple of rc
files, attempting to mmap the preview archive or loading the file into
memory if mmap fails. Only at first startup would we have to scan all
brushes, palettes, patterns, ... GIMP would then write the rc files
and generate a file with thumbnails. On subsequent starts GIMP would
only check that the data files still match the cached versions.

If someone wants to work on this stuff, please speak up. I won't have
time to spend on this feature anytime soon but I would try to help if
somone's interested.

Gimp-developer mailing list

Reply via email to