-
Notifications
You must be signed in to change notification settings - Fork 85
Description
Icon class has a very small LRU cache for SVGs and surfaces.
- https://github.com/sugarlabs/sugar-toolkit-gtk3/blob/master/src/sugar3/graphics/icon.py#L116 sets the cache size for SVG file contents,
- https://github.com/sugarlabs/sugar-toolkit-gtk3/blob/master/src/sugar3/graphics/icon.py#L159 sets the cache size for surfaces.
SVGs are not being cached; the cache attribute is not set by the callers.
Up to 50 surfaces are cached.
Initial demand is about 10 surfaces for the toolbar standard UI items. Each additional UI object with an SVG brings the activity closer to the limit. Once the limit is reached, the LRU cache can lose critical surfaces, and several user actions cause re-read and reprocessing of SVGs, resulting in slow response in the user interface. Effectively trading memory usage for CPU usage.
Icon class is used by many other classes.
- double the cache sizes and test on oldest used hardware, aaea860,
- set up an intentionally limited virtual machine, or old hardware,
- make performance measurements with varying cache sizes,
- recommend a changed cache size,
- recommend a changed cache algorithm (e.g. use reference counters).
Discovered while experimenting with the Icon class for the Chat activity smiley window. When more than 50 instances of Icon were created, hiding and showing the window took ten seconds, and scrolling took five seconds. Gtk.Image was used instead, see sugarlabs/chat@0f09a26.