Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by Eily (Monsignor)
on Mar 08, 2018 at 09:56 UTC ( [id://1210505]=note: print w/replies, xml ) Need Help??


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

chop will remove a character from the string each time, unless there is none. Since for aliases the variable to the list elements, the strings in @data get chopped until they are empty. As a matter of fact, since the lines are pretty short, the strings are empty before the 20th call to the function, and even without chopping, the function gets called more than 150 times

Edit: reformulated and shortened my confusing post :)

  • Comment on Re: Unexplained benchmark when using chop vs. chomp (or neither)

Replies are listed 'Best First'.
Re^2: Unexplained benchmark when using chop vs. chomp (or neither)
by Cristoforo (Curate) on Mar 08, 2018 at 15:48 UTC
    Thank you Eily. You have shown the problem that caused the results of the benchmark to be what they were.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-24 04:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found