Okay, I think I'm brain damaged -- nope, I figured it out

Mark Wieder mwieder at ahsoftware.net
Sat Sep 14 03:01:16 EDT 2013


Geoff-

Friday, September 13, 2013, 11:41:54 PM, you wrote:

> tl;dr: use put after, and don't use variables to work with more than about
> 100mb unless you have no choice.

Wow! Great benchmarking there. Thanks for doing the heavy lifting.

> before
>          put "xxxxxxxxxx" before R

> putting a string before a variable is slow, likely because it is either
> duplicating the whole string, or because it is shoving over the entire
> string to make room at the front. This only got up to a string 800k long
> before taking more than a second to iterate. It appears to be roughly
> linear on the size of the target string.

I think with proper engine optimization, "before" should be the
fastest option... all that's necessary to add A to B is to have the
end of A point to the beginning of B, then have B point to A. No extra
copies needed.

B:          bbbbbbbbbbbbb
A: aaaaaa

put A before B

B:          bbbbbbbbbbbbb
A: aaaaaa---^

            bbbbbbbbbbbbb
B: aaaaaa---^

-- 
-Mark Wieder
 mwieder at ahsoftware.net





More information about the use-livecode mailing list