Basic optimisation when adding or removing elements with visible=false to a gui table
Posted: Tue Apr 29, 2025 3:17 pm
Sometimes, it's convenient to add a very large number of rows to a table (1000+) but only show a small set of them, by keeping most of them set to visible = false. However, based on some testing (but without actually being able to see the code), it seems that adding elements to or removing elements from the table always causes layout to be recalculated, even if those elements have visible = false set.
If the table is hidden entirely, be it because it has visible = false set or is in an inactive tab, then adding or removing elements (visible or not) is very fast, so the game is clearly doing some kind of check to skip doing expensive re-layout. I believe that it should also check if the element being added or removed is hidden, and if so, also skip doing any kind of layout updates. This would make maintaining very large tables much simpler.
If the table is hidden entirely, be it because it has visible = false set or is in an inactive tab, then adding or removing elements (visible or not) is very fast, so the game is clearly doing some kind of check to skip doing expensive re-layout. I believe that it should also check if the element being added or removed is hidden, and if so, also skip doing any kind of layout updates. This would make maintaining very large tables much simpler.