Improve performance for setting .text on textfields

Post Reply
User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 232
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Improve performance for setting .text on textfields

Post by Therenas »

Currently, setting a large amount of characters on a textfield is slow. Setting textfield.text to a string with ~6000 characters in it takes ~6.5ms according to the ingame profiler. Is there anything that could be done to improve this? I know there might be good explanation for it, I'm just asking. The usecase is creating my own export strings for some data in my mod, which can quickly get in the thousands of characters long.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Improve performance for setting .text on textfields

Post by Rseding91 »

Do you have some example mod i can use to test?
If you want to get ahold of me I'm almost always on Discord.

User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 232
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: Improve performance for setting .text on textfields

Post by Therenas »

Sure, made one special for you. Lets you put in a character count and it inserts a string with that size into the textfield. Some more remarks in the code.
Attachments
textfieldtest.zip
(2.24 KiB) Downloaded 65 times

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Improve performance for setting .text on textfields

Post by Rseding91 »

I found a way to make it faster - at least for your specific example.
If you want to get ahold of me I'm almost always on Discord.

User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 232
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: Improve performance for setting .text on textfields

Post by Therenas »

Great, thanks a lot!

Post Reply

Return to “Implemented mod requests”