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