Regex (MatchText) speed

Brian Yennie briany at qldlearning.com
Thu Jun 24 02:58:07 EDT 2004


> take any input at all. At this point I'm figuring to do this part 
> later tomorrow or Friday, so cast yer votes!  ;-)

Well, here are a few tips for the bucket:

1) Offset() is the fastest call you've got. Try to avoid lineOffset() 
or itemOffset() if possible. "Contains" can also be slower, for some 
reason.

2) Determine if you need case-sensitivity. Setting the caseSensitive to 
TRUE (it's FALSE by default) provides around a 50% speedup by itself. 
Of course you can only use it if you actually are doing case sensitive 
work, OR you are able to convert things with upper() or lower() first 
and then restore them later in a clever fashion.

3) If things get complicated, consider using state variables to track 
where you are

4) Try to do everything in one pass (or as few as possible) if the data 
is large

5) Always use "repeat for each" when looping, not "repeat with"

6) If you've got it working and it just needs a little more pumping, 
people on list (who me?) tend to like to optimize things that get 
posted here provided that the poster has taken a good wack at it first 
=).

HTH,
- Brian



More information about the use-livecode mailing list