Way to speed up append strings?

Geoff Canyon gcanyon at inspiredlogic.com
Sun Nov 14 17:46:49 EST 2004


This code runs in 5 ticks on my computer:

on mouseUp
   put ticks() into t
   put empty into tTest
   repeat 64000
     put "t" after tTest
   end repeat
   put ticks() - t
end mouseUp

Since that's appending a single character 64,000 times, I assume it's a 
worst-case scenario. Can you post the actual code you're using, and 
what performance you're seeing?

regards,

Geoff Canyon
gcanyon at inspiredlogic.com

On Nov 14, 2004, at 7:20 AM, Frank Leahy wrote:

> I have a preferences file that is fairly large (30K+), and it's 
> created on-the-fly using "append string" functions, e.g.
>    put "this data and that data..." after thePrefs
>    put "some more data..." after thePrefs
>    put "even more data..." after thePrefs
>
> This is getting slower than I'd like, and it appears that the slowdown 
> is because the append functions are getting slow.  I'm guessing that 
> RunRev is reallocating memory on each append, then copying the 
> existing string and the appended string into the newly allocated 
> memory.  And because I have lots of little appends this really slows 
> things down (and no, there's no way to make the appends longer and 
> therefore fewer...).



More information about the use-livecode mailing list