Okay, I think I'm brain damaged -- nope, I figured it out
dunbarx at aol.com
dunbarx at aol.com
Thu Sep 12 14:30:43 EDT 2013
Geoff.
It likes appending even less:
--on mouseUp --slow
put "XXX" into temp
put the ticks into s
repeat 100000
put accum & temp into accum
end repeat
answer the ticks - s
end mouseUp
on mouseUp - faster
put "XXX" into temp
put the ticks into s
repeat 100000
put temp after accum
end repeat
answer the ticks - s
end mouseUp
The appending routine ramps up in time fairly linearly until you pass one million repeats. I just kept adding zeros to the repeat, starting with 100. After going from one million to ten milllion, it slows dramatically
Craig Newman
-----Original Message-----
From: Geoff Canyon <gcanyon at gmail.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Thu, Sep 12, 2013 2:05 pm
Subject: Okay, I think I'm brain damaged -- nope, I figured it out
For fifteen years now I've been telling people over and over, "Sure, you
can speed that up dramatically by using 'repeat for each...' instead of
'repeat with i = 1 to the number of...'"
And today, something is going horribly wrong with what I've written, and I
can't see what. :-/
<I wrote a bunch of stuff here about what I was doing to see if anyone
could figure out what was going on>
...okay, I won't bore you all with the details. The tl;dr is that this:
put "something" after myVariable
is very fast, but gets slower the bigger myVariable becomes. I'm slinging
around 100s of MBs, and LC doesn't really like appending strings to a 300mb
variable...
I have to change to read from my input line by line anyway, and I'll write
to my output the same way, and all the variables will be much smaller then.
Thanks for listening
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list