XP is just a number | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
BrowserUk operates in an environment in which it is vital to squeeze every last, living computron from any processor, algorithm or function with which he deals, so I am not inclined to dispute his assertion that indirect access is "vastly less efficient". The "vastly less efficient" was in response *only* to 7stud's suggested: my @ydata = @{shift()};. Duplicating multiple, multi-dimensional arrays (in the case of mat mult), in order to achieve the same, non-indirected notation as you get with aliasing is "vastly less efficient". Taking that quote, out of that context, is a strawman. I would say that the (untested) way I have re-written mmMxM() below is, to my taste, at least as clear as the original. For this simple example, it's not horribly more complex I grant you. But that is the tip of the iceberg. Rather than this hard-coded sized, square-matrix multiply, let's take the more general form of MxN MatMult:
Now the indirect notation would take a somewhat higher cost on clarity. Now consider that this is a method within an OO module, and the matrices in question are named instance variables in the object:
Yes, you can use temporaries for the array refs; and I've also exaggerated the syntax problem for effect, but even without that, this is preferable:
(IMO anyway :) PS. See also The seven good uses for local. With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
In reply to Re^4: aliasing arrays using typeglob under strict
by BrowserUk
|
|