Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: May Thy Closures Be Blessed

by adrianh (Chancellor)
on Apr 26, 2004 at 22:37 UTC ( [id://348344]=note: print w/replies, xml ) Need Help??


in reply to Re: May Thy Closures Be Blessed
in thread May Thy Closures Be Blessed

I get an 18% difference, not a 3%

Hmm. I do seem to have been lucky with my initial runs. I'm seeing between 3-10% on my box, but nothing near 18%. How odd.

Unfortunally, this technique can't be used if you are subclassing a class that doesn't coorperate

True. Although for hash based objects you could just use one slot for the key and still get safety for all your other state hashes.

I would have expected to be able to gain a little more by writing the methods like ...

Good point. Can any internals expert explain why +shift is so slow?

Replies are listed 'Best First'.
Re: May Thy Closures Be Blessed
by Abigail-II (Bishop) on Apr 26, 2004 at 22:41 UTC
    Although for hash based objects you could just use one slot for the key and still get safety for all your other state hashes.
    True, but then you make yourself dependent on the implementation of the superclass. It opens the door to collisions, and you get a problem when the superclass changes its implementation (say, it starts to use restricted hashes).

    Abigail

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-12-02 19:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found