Re: Speed comparison of regex versus index, lc, and / /i



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.)
.



Relevant Pages

  • Re: CPAN install failure - help?
    ... Sinan Unur wrote: ... Unless you are using cygwin, you very likely do not have the proper tools to compile Perl modules from scratch. ... Interestingly enough, I've also got Fedora Core 3 on another machine, and on that one, once I su'ed to root, the install worked the first time. ...
    (comp.lang.perl.misc)
  • Re: why the perl documents is hard to understand?
    ... Sinan Unur wrote: ... > you expect all Perl programmers the world over to delete all Perl ... What is it about the 'Generals' in this newsgroup. ... the comp.lang.perl.misc regulars, have something to teach me - yet I ...
    (comp.lang.perl.misc)
  • Re: Programming Newbie Question
    ... I'd just be repeating what Randy Webb already said. ... The problem with Perl is that unless you use it every day, ... because it is also the most powerful language I've come across. ... I love PHP because it does very little hiding of functionality like ASP ...
    (comp.lang.javascript)
  • Re: Space (s) count problem
    ... sub use_index { ... This is perl, v5.8.7 built for MSWin32-x86-multi-thread ... Binary build 813 provided by ActiveState ... Sinan Unur ...
    (comp.lang.perl.misc)
  • Re: an original perldoc viewer
    ... Ben Morrow wrote: ... >> I have been reprimanded for my lack of knowledge of perldoc material so I ... >> time) working on a machine that does not have Perl but is connected to ... <!DOCTYPE html ...
    (comp.lang.perl.misc)