Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: Tied Hashes vs. Objects

by BrowserUk (Pope)
on Oct 22, 2012 at 21:31 UTC ( #1000419=note: print w/ replies, xml ) Need Help??


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


Comment on Re^3: Tied Hashes vs. Objects
Select or Download Code
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!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1000419]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (11)
As of 2014-09-23 18:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (239 votes), past polls