Skip to content

pyst3m/application: cache bundles

Phileas requested to merge improve-bundle-loading into main

Loading each toml takes ~100ms, so this is a significant speedup for people that have a significant number of apps, and still a speedup for those that don't (we ship with 26 apps now).

Caches the toml data based on the change date and the filesize, saving them in /sd/apps/toml_cache.json, /flash/sys/apps/toml_cache.json etc. Because they're only written when an app is added or updated, it shouldn't use flash cycles too much, and as we're saving to one file it should be relatively chill on it. We also install apps by default to SD card, so it shouldn't even affect flash by default.

On @schneider's badge which took 29 seconds to boot in total (3.2s to load flash apps, 17s to load SD apps), it lowered boot time to 12 seconds (0.1s for flash, 1.08s for SD).

On mine it reduces bundle loading times from 2.6s and 1.5s to 100ms and 46ms, a bundle load time improvement of 26-32x.

Improving the toml parser at some point might be useful, but this is likely to be faster for regular boots in that case anyways.

Merge request reports