Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: A matter of sub pass by reference or copy

by choroba (Cardinal)
on Mar 13, 2021 at 20:29 UTC ( [id://11129590]=note: print w/replies, xml ) Need Help??


in reply to A matter of sub pass by reference or copy

The table tells us that the "copy" was able to run 171189 times per second, while the "ref 1" was able to run 5073751 times per second, i.e. 29 times faster.

Note that in practice, if you need to access each element of the array, repeated dereferencing can be slower than accessing the elements directly.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^2: A matter of sub pass by reference or copy
by h2 (Beadle) on Mar 13, 2021 at 20:33 UTC
    It's clearly time for me to step away from this, I've obviously been burning the candles at both ends for a bit too long, I blame my damaged brain for not seeing it so clearly. should I just remove this post since it's just about brain damage and lack of vision and not an actual problem, sigh.

      G'day h2,

      "... should I just remove this post ..."

      Well, it looks like you've done that already. This has rendered the only reply meaningless. Please see "How do I change/delete my post?" for a detailed discussion about this.

      I don't know what the original looked like, but a better way to handle this situation would be something like:

      Update: Please ignore! I was just misreading, badly, ... candle-burning ... brain damage ... yada yada. My apologies to the monks.

      Start of the original post ...

      ... end of the original post.

      Now, anyone coming to this thread for the first time, not only knows to ignore the original post, but can also make sense of any replies.

      By the way, striking out the original post can be most easily done by wrapping it with <strike>...</strike>. The markup for my example is:

      <strike> <p> Start of the original post ... </p> <p> ... end of the original post. </p> </strike>

      — Ken

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11129590]
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: (3)
As of 2024-04-19 22:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found