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

Re^2: Unexplained benchmark when using chop vs. chomp (or neither)

by choroba (Cardinal)
on Mar 08, 2018 at 09:37 UTC ( [id://1210504]=note: print w/replies, xml ) Need Help??


in reply to Re: Unexplained benchmark when using chop vs. chomp (or neither)
in thread Unexplained benchmark when using chop vs. chomp (or neither)

Note that both chop and chomp can take an array as the argument. Interestingly,
chop @copy;
makes mychomp and mychop just as fast as nada.
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^3: Unexplained benchmark when using chop vs. chomp (or neither)
by davido (Cardinal) on Mar 08, 2018 at 17:09 UTC

    Yes, I had considered setting up alternatives that pass an array to chomp and chop, but figured it wasn't going to be a very useful comparison for this specific situation. But absolutely, pushing the loop into internals is going to be a lot faster. In fact it wouldn't have surprised me if you had said that the array version was even faster than the 'nada' version, since the 'nada' version still has a loop, unless it's been optimized away, which I'm not sure on.


    Dave

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-04-23 13:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found