Your program is already heavily invested in the performance of hashes. Most objects use hashes as their underlying data structure. Every reference to a package variable results in multiple hash lookups (I think). And every call to a subroutine results in multiple hash lookups (I think).Well, then, think again. :)
To the first approximation, only packages use hashes for their internal structure, and most package symbol lookups happen only at compile time. (Any stored GV* is post-hash-lookup.) Apart from symbolic references (which are discouraged), the only major operation that historically used hash lookups implicitly at run time was method calls, and I think even that has been heavily optimized these days when the method name is known in advance.
There are other implicit uses of hashes, but these typically come into play only when you start using higher Unicodes characters in patterns, and even there the internals typically try to avoid using the hash in the common cases.
In any event, normal sub calls don't use any implicit hashes. They're already too slow as it is...
|Replies are listed 'Best First'.|
Re^5: Could we save the memory occupied by "undef" in an array?
by ikegami (Pope) on Nov 24, 2008 at 18:26 UTC