in reply to Re^3: Confused by RegEx count
in thread Confused by RegEx count

That's rather counter-intuitive. Just ran them myself and for me, match beats subst:

Rate length_subst subst match trans +literation length_subst 2080/s -- -88% -90% + -97% subst 17998/s 765% -- -16% + -77% match 21423/s 930% 19% -- + -72% transliteration 76797/s 3592% 327% 258% + --

This is perl 5, version 34, subversion 0 (v5.34.0) built for x86_64-linux-thread-multi.


🦛

Replies are listed 'Best First'.
Re^5: Confused by RegEx count
by Danny (Chaplain) on Feb 21, 2024 at 11:41 UTC
    Yet another data point with cygwin, everything updated 2/21/24.
                        Rate    length_subst           subst transliteration
    length_subst      6174/s              --            -92%            -98%
    subst            79622/s           1190%              --            -78%
    transliteration 355231/s           5654%            346%              --
    
Re^5: Confused by RegEx count
by choroba (Cardinal) on Feb 22, 2024 at 10:09 UTC
    Yes, I'm getting similar results in 5.39.6, but in 5.26.1, the substitution is faster.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]