Basic optimisation when adding or removing elements with visible=false to a gui table

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
jagoly
Burner Inserter
Burner Inserter
Posts: 14
Joined: Mon Dec 23, 2024 11:48 am
Contact:

Basic optimisation when adding or removing elements with visible=false to a gui table

Post by jagoly »

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.
Rseding91
Factorio Staff
Factorio Staff
Posts: 15724
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Basic optimisation when adding or removing elements with visible=false to a gui table

Post by Rseding91 »

Can you provide an example mod that shows the performance issues you're talking about? Without profiling, it's mostly guess-work about what might or might not be slow and what might help.
If you want to get ahold of me I'm almost always on Discord.
jagoly
Burner Inserter
Burner Inserter
Posts: 14
Joined: Mon Dec 23, 2024 11:48 am
Contact:

Re: Basic optimisation when adding or removing elements with visible=false to a gui table

Post by jagoly »

I've opted to instead just destroy and create rows as needed for my mod, so I don't have a real example to show anymore. Feel free to close this if it is unlikely to be looked into without a good example :)
Post Reply

Return to “Modding interface requests”