in reply to Re: Difference between (foo|) and (foo)?
in thread Difference between (foo|) and (foo)?

I added foo_ro => sub { /^(|foob)foofoo/ foreach (@string) } (and upped the iterations) and got
Benchmark: timing 500000 iterations of foo_or, foo_qs, foo_ro... foo_or: 3 wallclock secs ( 2.55 usr + 0.00 sys = 2.55 CPU) @ 19 +6386.49/s (n=500000) foo_qs: 3 wallclock secs ( 2.45 usr + 0.00 sys = 2.45 CPU) @ 20 +3832.04/s (n=500000) foo_ro: 2 wallclock secs ( 2.39 usr + 0.00 sys = 2.39 CPU) @ 20 +9205.02/s (n=500000) Rate foo_or foo_qs foo_ro foo_or 196386/s -- -4% -6% foo_qs 203832/s 4% -- -3% foo_ro 209205/s 7% 3% --
This shows the ro doing better than even the qs. I suppose that (foob|) vs (|foob) depends on the data(?).

--traveler

Replies are listed 'Best First'.
Re: Re: Re: Difference between (foo|) and (foo)?
by theorbtwo (Prior) on Sep 29, 2002 at 01:00 UTC

    (|foob) is the same as (foob)??; (foob|) would be (foob)?, so comparing them isn't really fair.


    Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).