lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

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
	$var =~ /^\d+\s/o;	# 'o' for once, compile once, cache, reuse

	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.