http://www.perlmonks.org?node_id=1000419


in reply to Re^2: Tied Hashes vs. Objects
in thread Tied Hashes vs. Objects

As it had been a long time since I'd performed this kind of benchmark, I did one:

The results:

__END__ C:\test>b-tieHash.pl 8376437/16777216 std hash usage took: 56.582 seconds 8376437/16777216 tied usage took: 210.352 seconds 8376437/16777216 Object usage took: 126.642 seconds

show that using the object interface saves 1 microsecond per key, spread across all 5 operations performed on each key/value, Say 1/5th of a microsecond (0.0000002) per operation. You need to be doing billions of hash operations -- with almost no other associated processing -- for that to become a significant part of your time costs.


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.

RIP Neil Armstrong

Replies are listed 'Best First'.
Re^4: Tied Hashes vs. Objects
by tkemmer (Initiate) on Oct 23, 2012 at 07:03 UTC

    Thank you very much for your effort!

    At least to me, this really busts the "Tied Hashes are Expensive" myth, so the decision whether to use tied hashes or an object interface should definitely not be based on performance, but rather on matters of style and clarity. Thanks again!