|Welcome to the Monastery|
Ref to hash entries are faster?by Wiggins (Hermit)
|on Nov 29, 2006 at 19:53 UTC||Need Help??|
Wiggins has asked for the wisdom of the Perl Monks concerning the following question:
Old habits dye hard, or at least dark grey.
Coming from a 'C'/C++ background, I hate to constantly access an array element in a loop using the array subscripting. I prefer a pointer to the entry after computing subscripts once.
With a hash, is it better to take a reference to the the keyed scalar, or repeatedly recompute the hash?
A snippit of a 60 line loop
Does 'locality or reference' optimized that hash access, or is the key rehashed on every use in the loop?
Wisdom is needed, please