Manipulating large qtys of text

Barry Levine themacguy at mac.com
Wed May 15 11:42:01 EDT 2002


Well, got my license this AM so I'm official, eh?

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.

set the itemDelimiter to tab
set the lockScreen to true
set the lockMessages to true
repeat with i=1 to the number of lines in myField
	put i into item 1 of line i of myField
end repeat

The above is dog-slow so I put the contents of the field into a variable 
and work with the var, thusly:

set the itemDelimiter to tab
set the lockScreen to true
set the lockMessages to true
put field myField into var
repeat with i=1 to the number of lines in var
	put i into item 1 of line i of var
end repeat
put var into field myField

The above is much faster, of course.

Hewever, when we get to about 4500 lines in the field, even working with 
the text in a variable takes a little over two minutes to do the 
replacement of the text in item 1 of each line. Note that working with 
this larger qty of text does not take proportionately longer than a 
field of 1/4 the size; it's almost exponentially longer. I'm running OSX 
(10.1.4) on a 300MHz B&W and have 448MB of RAM

Is there an external that would speed this up or, perhaps, is there a 
more efficient method for thrashing through the container?

Thanks,
Barry




More information about the use-livecode mailing list