On Thu, 8 Sep 2005, Nigel Metheringham wrote:

> However perl is normally pretty fast for regexp application (especially
> as you do need to do all that horrid UTF8 stuff) although there are
> cases that go really nasty.

Well, all I can say is that when I feed the PCRE pattern matching tests 
to Perl, they run much more slowly. This is the main test, which has 704 
different patterns, with various numbers of data lines:

Using pcretest:
real    0m0.003s
user    0m0.000s
sys     0m0.001s

Using Perl:
real    0m1.000s
user    0m0.974s
sys     0m0.007s

However, I haven't taken any measures to optimize the Perl (for example,
it probably recompiles each pattern for each match). Therefore, these 
are "worst case" figures which no doubt could be improved. Nevertheless,
I would not expect Perl ever to be able to catch up: it is, after all,
essentially an interpreted language. You cannot expect it to be as fast
as compiled code. Even a few percent can be important when millions of 
regex matches are happening.

-- 
Philip Hazel            University of Cambridge Computing Service,
[EMAIL PROTECTED]      Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book:    http://www.uit.co.uk/exim-book

-- 
## List details at http://www.exim.org/mailman/listinfo/exim-users 
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://www.exim.org/eximwiki/

Reply via email to