I noticed, that initialization time increased on every screen addition in SLS.
Sure it will increase, but when running a test with about 30 screens, I ended up on !!!8900ms!!! initialization time on an ESP32-S3 system.
In general, what is the best practice with SLS when using that many screens? Is there a way to prioitize some screens and load others in background? Any project settings that require my attention?
Is it lv_init() that takes 8900ms or something else? Our lv_init() takes ~4ms with more screens than you’ve got, but most of our screens are temporary. Managing this does come with its own complexity though.
Generally it’s a good idea to use temporary screens (by checking the corresponding flag in SquareLine Studio inspector for the screens), so you don’t need to slowly load all screens at startup and take that much memory for them. (But temporary screens need careful handling of animations/etc. on the other hand.)
Slowdown now can also be related to the dynamic memory reallocation of the new theme-handling code, as reported by some. Meanwhile this code got converted/optimized into a better-suited linked-list variant, but if you have a slow(ish) memory, the current theme-handler code (exported if you use global colors/themes) can be one of the reasons for your slowdown. Simply deleting themes and global colors (auto-converted back to RGB) turns off exporting theme-code.
(Some profiling on your code with gprof or callgrind might shed a light on the most-used functions, they can even be i18n-related if there are many dictionary lookups.)
Turning off themes or multilanguage did NOT decrease startup time.
Having plenty of screens marked “temporary” did significantly reduce startup time, but intelligent widget update handling based on settings will be required, as controller otherwise will crash.
So I will need deeper understanding on temporary screens. Once creating/init a temporary screen, will it resist and be available in background until deleted? What would be best practice to implement temporary screens handling?
Unfortunately the temporary screens don’t remain in the background but get deleted, that’s the essence of using them, to reduce memory consumption. The exported UI code opens/closes temporary screens fine, but every dynamic widget’s position/text should be recreated from variables upon reopening those screens. That’s one of the culprits among the several others, preparing screen_loaded functions for all screens in SquareLine Studio can be used to initialize those when the widgets to adjust appear. Other quirks are checking object and screen availibility with lv_obj_is_valid() before modifying it. Animation-callbacks should be deleted when the screen of their target is deleted.
(If you still want to go without temporary screens, I still suspect you have a slow memory or similar bottleneck for your actual design’s complexity. LVGL uses dynamic memory allocations for styles/etc. in the background. Maybe try playing with LV_MEM_CUSTOM settings, but not sure if memory allocation will help much in this case, just a tip.)