Initialization performance improvements

I plan to do some big performance-related improvements to the initialization time in one of the future updates, so I wanted to post some information here beforehand.

Currently WebLaF compiles about 1000\~1500 styles upon initialization out of which you normally only need about 100\~300 in runtime at most and the rest are unused. While memory-wise it's mostly irrelevant (only takes a few megabytes) - it does slow down initialization a lot.

To be more specific - initialization might take up to 5-6 seconds (on Java 6) on slower PCs due to the amount of loaded and compiled styles. And main time out of those 5-6 seconds is compilation of the styles.

While this is partially solved by using newer Java runtime (5-6 seconds become 1-3 seconds on Java 8 and under 1 second on Java 11+) - I constantly add new styles to the base skins which continues to slow down the initialization.

I plan to make all styles compiling lazy - they will only compile once requested by some component. Once compiled they will be cached like they do right now. This change will be a huge performance improvement and will also lift some limitations from SkinExtensions and other parts of the styling system, but I'll talk about that later on once I get these changes done.


2020/11/22 18:27
  • 点赞
  • 收藏
  • 回答