|go ahead... be a heretic|
Re^4: Threads and fork and CLONE, oh my!by jdhedden (Deacon)
|on Sep 16, 2005 at 17:57 UTC||Need Help??|
The performance of the blessed hash case is dependent on the length of the keys used in the hash: The longer the key, the more time it takes!
For one-character keys, blessed hashes are slightly faster than the cached refaddr case. (I got 2% when I did the timings.) However, one-character keys are rather unrealistic, and definitely not good programming practice.
For two-character keys, the performance is the same.
For three or more characters, cached refaddr is faster! I think five characters is realistic, and their performance is 2% slower. For ten characters, 7% slower!
So if I were to call a winner, cached refaddr would be it.
On another minor note, 0+$self yields the same result as the refaddr function. So you can eliminate 'use Scalar::Util', and just cache 0+$self.
Remember: There's always one more bug.