regex question

Richard Gaskin ambassador at fourthworld.com
Sun May 18 15:30:54 EDT 2008


J. Landman Gay wrote:
> In my RevLive presentation I addressed this kind of processing, and 
> showed the results of a number of speed tests. It turns out that a 
> "repeat for each" loop is almost 200 times faster than a regex 
> expression.

My own benchmarking over the years yields similar results.

In fact, given that Rev's Regex engine is quite similar to the one in 
Perl, I'd be surprised if Perl is any faster at such tasks (but always 
willing to hear of benchmarks to the contrary).

The value of Regex is its convenience for the developer, but its 
highly-generalized nature implies a level of overhead that will impair 
performance relative to more specialized solutions.

There are no doubt some expressions in Regex that will benchmark faster 
due to the number of step needed to accomplish them by other means, but 
on the whole I find crafting one-offs using "repeat for each" to be 
faster by at least an order of magnitude for a surprisingly wide range 
of tasks.


Even with mere runtime compilation, many Rev string tasks perform on par 
with systems that make you deal with the old-school runtime-compile cycle.

Now imagine how much faster still things could be if Rev took advantage 
of the fact that all three supported platforms now use the Intel 
instruction set, and implemented true machine-level compilation.... 
(drool, drool)

-- 
  Richard Gaskin
  Managing Editor, revJournal
  _______________________________________________________
  Rev tips, tutorials and more: http://www.revJournal.com



More information about the use-livecode mailing list