[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: precompiled regex's to lua
- From: Asko Kauppi <askok@...>
- Date: Thu, 9 Nov 2006 22:58:22 +0200
I didn't find any reference to discussing precompiled regular
expressions, and Lua.
Some background:
In huge log file handling, Lua loses to Perl (not by much!) seemingly
because it has no concept of precompiling, and then applying the
regular expression patterns.
In Perl, one can:
my $re= qr/^\d+\s/;
$var =~ $re; # $re is a precompiled, optimized regex, applied to $var
or:
$var =~ /^\d+\s/o; # 'o' for once, compile once, cache, reuse
Lua:
string.match( var, "%d+%s" ) -- is "%d+%s" analyzed anew each time?
Is Lua losing in speed, since it has not this concept, or have the
authors been so clever, it's already "there", just invisible? :)
We're talking BIG files, say 1 million lines, or more.
-asko