Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^4: Confused by RegEx count

by NERDVANA (Deacon)
on Feb 22, 2024 at 06:17 UTC ( [id://11157834]=note: print w/replies, xml ) Need Help??

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

I get results like hippo's with perl 5.36 on a recent AMD Ryzen
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.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11157834]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-21 23:39 GMT
Find Nodes?
    Voting Booth?

    No recent polls found