in reply to Re^2: Speed of simple pattern count. A comparison
in thread Speed of simple pattern count. A comparison

Most of your tests use a 30,000 character string but your "split_by" test uses a 30,002 character string so the tests are not exactly equivalent.

Just saying ...     :)

Naked blocks are fun! -- Randal L. Schwartz, Perl hacker
  • Comment on Re^3: Speed of simple pattern count. A comparison

Replies are listed 'Best First'.
Re^4: Speed of simple pattern count. A comparison
by rsFalse (Chaplain) on Jan 07, 2024 at 21:59 UTC
    I agree, this one test uses +2 more characters, but it is like included in the test as a tool.
    But now I think the first 'x' which is prepended is simply redundant, because if the string starts with "ab", it anyways gives an empty string as a leftmost result. The appended 'x' is not redundant, because if the string ends with pattern "ab", then it doesn't produce an empty string as a rightmost result. But here comes 'split' with three parameters with third being '-1', and then there is no need to append something like 'x'.