in reply to Re^3: Confused by RegEx count
in thread Confused by RegEx count
Rate length_subst subst match trans +literation length_subst 8970/s -- -89% -91% + -97% subst 78884/s 779% -- -19% + -78% match 97126/s 983% 23% -- + -73% transliteration 355019/s 3858% 350% 266% + --
Though, depending how many matches there are, does perl have to assemble a stack of N elements (copying each character into its own scalar) before assigning the list to the scalar to get the count? With the subst, the right optimizations could allow it to update that one character without changing the length of the string or copying anything, so it could be fast, and then doesn't need to assemble a list of the matches.
|
---|