more useful options | |
PerlMonks |
Re: Ref to hash entries are faster?by GrandFather (Saint) |
on Nov 29, 2006 at 21:12 UTC ( [id://586822]=note: print w/replies, xml ) | Need Help?? |
If you wish to ignore Tanktalus's good advice and sweat the small stuff then a benchmark gives an answer. Normal benchmark caveats apply of course - like the benchmark may not indicate anything at all about your particular situation.
Result:
Note that the result is somewhat sensitive to the number of key/value pairs in the hash. 46% is about the largest difference I've seen. Note too that at about 200 nano-seconds per access this tweak is unlikely to make much difference to most applications. Code clarity would be a much more important consideration! DWIM is Perl's answer to Gödel
In Section
Seekers of Perl Wisdom
|
|