Re: Speed comparison of regex versus index, lc, and / /i
- From: Ben Bullock <benkasminbullock@xxxxxxxxx>
- Date: Sat, 31 May 2008 11:13:39 +0000 (UTC)
On Sat, 31 May 2008 07:19:24 +0000, John W. Krahn wrote:
On my machine and version of Perl a get a speed improvement by using a C
style for loop instead:
I think this is just an artifact of using a string which matches
several times.
On my machine and version of Perl regex_unur_find() and
regex_morrow_find() are statically the same;
Rate regex regex_unur regex_morrow index_while
index_for
regex 144442/s -- -5% -6% -16%
-17%
regex_unur 151952/s 5% -- -1% -11%
-13%
regex_morrow 154059/s 7% 1% -- -10%
-12%
index_while 171325/s 19% 13% 11% --
-2%
index_for 174905/s 21% 15% 14% 2%
I repeated the test with Perl 5.8 and got similar results to you.
It seems like the Ben Morrow version has been de-optimized, and the
A. Sinan Unur version optimized, in Perl 5.10.
Perl 5.10:
regex_morrow 138889/s -- -32% -40% -40%
regex 204082/s 47% -- -12% -12%
regex_unur 232558/s 67% 14% -- -0%
index 232558/s 67% 14% 0% --
Perl 5.8:
regex 178571/s -- -7% -7% -21%
regex_unur 192308/s 8% -- -0% -15%
regex_morrow 192308/s 8% 0% -- -15%
index 227273/s 27% 18% 18% --
(repeating the test several times gave both faster and slower times
for unur and morrow versions, with both being roughly the same.)
.
- References:
- Speed comparison of regex versus index, lc, and / /i
- From: Ben Bullock
- Re: Speed comparison of regex versus index, lc, and / /i
- From: xhoster
- Re: Speed comparison of regex versus index, lc, and / /i
- From: Ben Bullock
- Re: Speed comparison of regex versus index, lc, and / /i
- From: A. Sinan Unur
- Re: Speed comparison of regex versus index, lc, and / /i
- From: Ben Bullock
- Re: Speed comparison of regex versus index, lc, and / /i
- From: John W. Krahn
- Speed comparison of regex versus index, lc, and / /i
- Prev by Date: Re: FAQ 4.17 How do I find yesterday's date?
- Next by Date: Re: Speed comparison of regex versus index, lc, and / /i
- Previous by thread: Re: Speed comparison of regex versus index, lc, and / /i
- Next by thread: Re: Speed comparison of regex versus index, lc, and / /i
- Index(es):
Relevant Pages
|