2 Attachment(s)
A Slow Fast Loop... Or Bad Coding?
Okay, here is the problem I am having with my fast loops, type or paste a large amount of text into the top text area, then click "Go!". You will notice that the application will sort of freeze, and after a long while the output text will finally be visible. I do not know what I did wrong, I coded it efficiently as possible, at least as far as I know. Related to this post.
-Variant
Re: A Slow Fast Loop... Or Bad Coding?
Yes, making constant changes to an edit box during a fast loop is slow. What you should do is make a global string variable, edit/append data to the global string variable in the fast loop, then copy it to the edit box after the loop.
Re: A Slow Fast Loop... Or Bad Coding?
Yep, checked out the code and problem is you're using an immutable string type. Each it appends a string by doing:
"set text of edit box = string + %"
it does this not by altering the existing string, but rather by creating an entirely new string and setting its value to this result. So each append action constructs a new string, of length of the current result. So for the entire thing, you'll end up using (# of loops) * (length of output / 2) size of string objects. I think ryan is correct that global strings are mutable and thus you could edit them with little slowdown, but I personally use the binary data object
Re: A Slow Fast Loop... Or Bad Coding?
The percent (%) sign is a delimiter, I'm not really sure how that would work, but I'll try it, thanks.
-Variant