Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff

by likbez (Sexton)
on Sep 17, 2020 at 06:11 UTC ( [id://11121860]=note: print w/replies, xml ) Need Help??


in reply to Re: What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff
in thread What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff

eh? How does being force to use $_ add opportunities for optimization?
Theoretically the fact that there are several comparisons allows to make comparison to $_ with long strings faster (say more then 64 characters long). If the switch contains several "when" branches with string constants you can pre-compute hash of them and first compare a hash of $_ with hash of the constant and only if hash matches perform full comparison: you need to compute a single hash of $_ for all comparisons. If all "when" branches represent search without meta characters you can pre-compute a table via Knuth-Morris-Pratt for strings search.
  • Comment on Re^2: What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-19 22:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found