Edit widget very inefficient...

Walley

04-09-2009 14:10:33

I've recently implemented a console within my application (somewhat like the console demo), and I noticed that as the length of text in the console gets of any significance, the performance of Edit::addText was getting pretty horrible (with very noticeable delays between entering a command and seeing the output appear)...

So I dug inside... and found that the entire string is iterated (and in search of colour tags (#), though I couldn't decipher the comments to figure out why (and it's only when the new text starts with a colour tag)) just to add text to the end, and then is entirely iterated again. Now for my own purposes I've hacked in a few changes to so far make addText more efficient (such as measuring the length of the text to be added rather than the measuring the length of all the text after it is, not searching for colours in the existing text (this one's more situational). Right now I'm dealing with the updateRawData ordeal so as to have the scroll bar updating without scanning the entirety. I only just started looking at that a few minutes ago but my initial hope is that I can simply calculate the changes from the additional length being added, and adjust the existing raw data accordingly. Obviously these optimisation apply to the special case of adding text to the very end - inserting in the middle is another matter. You'd probably have to overhaul the way the colour tags are stored (such as having a separate list of them with their locations - this would both make searching for the previous colour much quicker, but would also mean that you could simply do an mText.size() instead of measuring the length character by character).

Anyway was wanting to find out if you have plans to optimise this in the near future (I ask so as to decide between waiting for an update or completing my hacky fixes)?

Sorry if there's any sense of irritation in my post, I don't mean to be :P. I'm slightly stressed at digging through code with russian comments haha, so it might be rubbing off into my message ;).

my.name

04-09-2009 16:24:46

MyGUI version ?

Walley

04-09-2009 17:08:07

2.2.2.