Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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 ( #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
Node Status?
node history
Node Type: note [id://11121860]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2021-06-19 11:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (92 votes). Check out past polls.

    Notices?