Manipulating large qtys of text

Ken Ray kray at sonsothunder.com
Wed May 15 13:15:00 EDT 2002


Barry,

One thing that should speed things up is the use of "repeat for each
<chunk>" instead of "repeat with". Here's an example (I haven't tested it,
but it should work):

set the itemDelimiter to tab
set the lockScreen to true
set the lockMessages to true
put fld myField into var
put 1 into i
repeat for each line tLine in var
  put i into item 1 of tLine
  put tLine into line i of var
  add 1 to i
end repeat
put var into field myField

It may seem like it takes longer because of more code, but it may very well
be faster.

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/

----- Original Message -----
From: "Barry Levine" <themacguy at mac.com>
To: <use-revolution at lists.runrev.com>
Sent: Wednesday, May 15, 2002 11:37 AM
Subject: Manipulating large qtys of text


> 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
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list