Manipulating large qtys of text - Wow!

Barry Levine themacguy at mac.com
Wed May 15 20:40:01 EDT 2002


Geoff,

Holy smoke! 66 ticks is all it took to do 5500 lines (instead of the 
120+ seconds). Looking over the code, it appears that populating a new 
variable is substantially faster than changing an existing one. 
("Substantially"? That's an understatement!) This is great stuff to 
know! Probably would make an excellent tip for the RunRev website, eh?

Mucho Thanks!

Barry


> Message: 8
> Date: Wed, 15 May 2002 14:16:13 -0700
> To: use-revolution at lists.runrev.com
> From: "Geoff Canyon" <gcanyon at inspiredlogic.com>
> Subject: Re: Manipulating large qtys of text
> Reply-To: use-revolution at lists.runrev.com
>
> At 10:37 AM -0600 5/15/02, Barry Levine wrote:
>> Okay, let's assume I don't want to use Valentina and want to keep 
>> everything "inside" Revolution. What are the practical limitations to 
>> the length of text fields? For example: I have a field with 5000 lines 
>> of text (tab-delimited). Let's assume that the itemDelimiter is 
>> already "tab". The first item in each line is a number. I want to 
>> renumber the lines sequentially.
>
>
> At 8:50 PM +0200 5/15/02, Ludovic ThÈbault wrote:
>> set the itemDelimiter to tab
>> set the lockScreen to true
>> set the lockMessages to true
>> put field myField into var
>> put 0 into tNum
>> repeat for each line l in var
>> add 1 to tNum
>> 	put tNum into item 1 of line tNum of var
>> end repeat
>> put var into field myField
>
>
> The above still forces Revolution to figure out where each line of the 
> variable is in order to insert the modified line. At the cost of extra 
> memory, this will be much faster (factor of 40 for 5000 lines on my 
> machine):
>
>   set the itemDelimiter to tab
>   put field 1 into tVar
>   put empty into tNewVar
>   put 0 into tNum
>   repeat for each line L in tVar
>     add 1 to tNum
>     put tNum & tab & (item 2 to -1 of L) & cr after tNewVar
>   end repeat
>   put char 1 to -2 of tNewVar into field 1
>
> --
>
> regards,
>
> Geoff Canyon
> gcanyon at inspiredlogic.com
>
--------------------------------------------------------




More information about the use-livecode mailing list