Newbie3
dunbarx
dunbarx at aol.com
Mon Dec 8 13:13:34 EST 2008
Richard:
Thank you.
I get all that, and must admit it sounds impressive. I'll make large piles of data and play around with the several forms.
My poor, neglected HC...
Craig Newman
On Dec 8, 2008, at 12:49:06 PM, "Richard Gaskin" <ambassador at fourthworld.com> wrote:
From: "Richard Gaskin" <ambassador at fourthworld.com>
Subject: Re: Newbie3
Date: December 8, 2008 12:49:06 PM EST
To: "How to use Revolution" <use-revolution at lists.runrev.com>
dunbarx wrote:
> This is the sort of thing I wrote, too. HC code would be similar
> ; I'll take your word for the speed.
>
> I was wondering if there was something snazzy in Rev (that was not
> in HC) that did not require running through the whole body of text,
> in other words, directly, like the new "replaceText" function that
> is a one-line substitute for "fullReplace". Very Rinaldi-like.
While the algorithms you would use in Rev and HC may appear similar in
some respects, don't underestimate the power of "repeat for each". This
form of repeat was not available in HC, and is at least one or two
orders of magnitude faster than "repeat with i = 1 to the number of
lines...".
The reason for the incredible speed difference between the two is that
"repeat for each" makes the assumption (indeed requires) that the text
being parsed will not change during the repeat, while "repeat with..."
cannot know this in advance.
So when running "repeat with i = 1 to the number of lines", each time
through the loop it needs to count the lines from 1 to i, and then you
can say "get line i" and that will once again count from 1 to i to
obtain the line. Lots of redundant overhead, but necessary
...
...
More information about the use-livecode
mailing list