10x loading time for opening of gui editor when useSmallestIdeal=true

Hey, since in the original discussion ( Introducing Inspector v2 ) no one answered so far and this is probably the better place to discuss, I’ve moved the report here. (@ryantrem)

I think I can now reproduce the long loading times of the gui editor, tested with multiple browsers (Firefox 158.0, Chrome 155.0.8059.85, both 64bit on Windows 11, babylonjs 9.30.0)

In this playground example I’ve created a simple full screen gui with 2000 (also tested with 1000) rectangles with a text block on top. I’ve also set idealWidth and idealHeight of the advanced texture.

When you open the gui editor through the inspector everything seems to work as expected, loading only takes setting around 6 seconds, but when you set useSmallestIdeal = true in line 24 and do the same thing the loading time is like ten times longer. I’ve tested multiple values, here are the loading times:

useSmallestIdeal = false:

loop 1000 - 2 seconds

loop 2000 - 6 seconds

useSmallestIdeal = true:

loop 1000 - 25 seconds

loop 2000 - 1 minute 10 seconds

I don’t know why exactly this causes the long loading times, but this setting combined with lots of gui elements seems to be responsible.

Thanks for the clear reproduction! I reproduced the slowdown and opened a fix.

When opening the editor, each control is serialized and cloned. Serialization was repeatedly invalidating the entire GUI and recalculating fonts, which becomes particularly expensive with useSmallestIdeal = true. The fix avoids these unnecessary updates while preserving adaptive scaling and the live GUI’s font caches.

In local measurements using your setup, the cloning step for 1,000 rectangles dropped from about 27 seconds to 51 ms. With 2,000 rectangles, it takes roughly 130 ms with either setting. These timings cover cloning, not total editor startup.