in reply to Re^3: Why does global match run faster than none global?
in thread Why does global match run faster than none global?

Which pretty much leaves only compiler differences...

That was my conclusion, too.

BTW, on second glance I noticed that your figures are about an order of magnitude slower in absolute terms, compared to what I and the others got — which made me wonder what hardware you were using.

Don't get me wrong, I'm not into some childish "mine is bigger" kind of silly thing... Not at all, it's just that if we presume roughly comparable hardware, what might account for that order-of-magnitude difference?  Compiler differences, too?

Just for comparison, the CPU I ran the test on is a 2.3 GHz AMD Phenom 9600 quad-core — which was already pretty "standard" at the time I bought the machine 3 years ago. (The quad-core should be irrelevant here, as the benchmark uses one core only anyway.)

  • Comment on Re^4: Why does global match run faster than none global?

Replies are listed 'Best First'.
Re^5: Why does global match run faster than none global?
by BrowserUk (Patriarch) on Aug 24, 2011 at 07:37 UTC
    on second glance I noticed that your figures are about an order of magnitude slower in absolute terms, compared to what I and the others got

    Hm. I have an Intel Core2 Quad Q6600 @ 2.4 GHz. So now I'm really baffled!


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re^5: Why does global match run faster than none global?
by BrowserUk (Patriarch) on Aug 25, 2011 at 04:24 UTC
    I noticed that your figures are about an order of magnitude slower in absolute terms,

    There appears to be nothing wrong with my set-up, and nothing I tried has allowed me to start and stop the regex engine in less than 1 microsecond.

    I strongly suspect that all the timing showing millions/s are wrong. I think that the posters have tested code along the lines of:

    use Benchmark qw[ cmpthese ]; my $str = '123456789'; cmpthese -1, { a=>q[ my ($a,$b) = $str =~ m/(23)[^8]+(8)/g; ], b=>q[ my ($a,$b) = $str =~ m/(23)[^8]+(8)/; ], c=>q[ my ($a) = $str =~ m/(23)/g ], d=>q[ my ($a) = $str =~ m/(23)/; ], };;

    Note the my which means that when the tested are evaluated $str will be undefined.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.