Way to speed up append strings?

Frank Leahy frank at backtalk.com
Sun Nov 14 10:20:32 EST 2004


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...).

My question is this: is there a way to tell RunRev that I want it 
should start with a big string block (e.g. 64K of memory), when I first 
create the string?

If not, I'll have to go to a "write to temp file and then re-read from 
temp file" type of solution (because writing and reading to a temp file 
appears to be significantly faster than doing lots of little appends).

Thanks,
-- Frank

Web Photos Pro: Software for Photo Bloggers and Other Photo Power Users
See us on the web at http://www.webphotospro.com/



More information about the use-livecode mailing list