Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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

by Eily (Prior)
on Mar 08, 2018 at 09:56 UTC ( #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
Node Status?
node history
Node Type: note [id://1210505]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2018-09-21 19:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Eventually, "covfefe" will come to mean:













    Results (190 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!