in reply to Re^5: question about reg exp engine
in thread question about reg exp engine

Changing "  stuff  " to (' ' x 1000) . 'x' . (' ' x 1000) gives:

Rate r1 r3 r1 1849/s -- -99% r3 166166/s 8888% --

It is important that a benchmark test what you think it is testing so what you think is being tested must entail a significant portion of the benchmark's processing time.

Update: BTW, my result for your original benchmark was:

Rate r1 r3 r1 767220/s -- -10% r3 855450/s 11% --

Perl reduces RSI - it saves typing

Replies are listed 'Best First'.
Re^7: question about reg exp engine
by broomduster (Priest) on Aug 04, 2008 at 00:43 UTC
    I didn't see this reply before I Updated above, but now we're in the same direction, even if the magnitude of difference is off. As I said earlier, the largest difference I saw for the short string was 3% (about a dozen runs, looking back).

    BTW, I can confirm your observation about the penalty associated with 'nibble' vs. 'swallow' vs. both.