Deleting Data Woefully Slow
Alex Tweedly
alex at tweedly.net
Thu Mar 25 20:57:48 EDT 2010
Kay C Lan wrote:
> On Thu, Mar 25, 2010 at 8:08 PM, Richard Gaskin
> <ambassador at fourthworld.com>wrote:
>
>
>> Moreover, Raney once noted that he took the time to optimize
>> "put...after..." specifically for cases like yours, so it could be used in
>> conjunction with "repeat for each" to build a subset of data.
>>
>> Richard,
>>
>
> any thoughts as to why delete line -1 is so so much slower than delete line
> 1? Seems illogical.
>
delete line 1 requires
search for 1st CR (i.e. scan 30-80 chars)
either : copy from there to the end (i.e. move each character).
or: manipulate some pointer to say where the data starts
I don't know which of these rev does.
delete line -1 requires
search for every CR (i.e. scan every char in the whole large
piece of data)
adjust some pointer to truncate
Scanning is much slower than simply copying.
You can see this by comparing the times for
> put the milliseconds into tStart
> repeat K timeScale
> put the number of lines in largeData into t
> end repeat
> put the milliseconds - tStart & CR after field "F"
>
> put the milliseconds into tStart
> repeat K times
> put largedata into t
> end repeat
> put the milliseconds - tStart & CR after field "F"
>
-- Alex.
More information about the use-livecode
mailing list