Slow thumbnail generation due to font issues
So I was investigating a slowdown in eog while auto-reloading SVG files, and it seems the problem was in the thumbnail generation, which was taking ~10s. (For a tiny SVG, mind you.) More specifically,
gdk-pixbuf-thumbnailer complained about not finding a font config and spent a lot of time looking at fonts. Adding
--ro-bind /var/cache/fontconfig /var/cache/fontconfig to the arguments for bwrap fixed the issue and the time is down to ~0.2s.
- Make a folder with two SVGs, e.g.
mkdir temp && cd temp echo '<svg><text>A</text></svg>' > a.svg cp a.svg b.svg
- Open one of them in eog
eog a.svg &
- Note how switching between the two files using arrow keys does not incur noticeable delay
- Overwrite the svg not currently viewed
cp a.svg b.svg
- Switching between image files is not possible within the next ~10s (apart from that the application stays responsive)
libgnome-desktop/gnome-desktop-thumbnail-script.c, like this:
add_args (array, "bwrap", "--ro-bind", "/usr", "/usr", + "--ro-bind", "/var/cache/fontconfig", "/var/cache/fontconfig", "--ro-bind", "/etc/ld.so.cache", "/etc/ld.so.cache", NULL);
This fixed the problem on my machine.