-
-
Notifications
You must be signed in to change notification settings - Fork 753
Remove performance degradation caused by DelegateClass
#1008
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few concerns here:
- Several of these methods take blocks and you aren't properly forwarding them. (e.g.
fetchanddelete). - Why only this set of methods? Hash has many other methods, I believe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was what was required to implement the MetaData functionality. Do we want it to behave entirely like a hash, or is it acceptable to provide only our own api? I'm open to restoring the block forwarding though.
|
I think it's worth looking into doing something like: require 'forwardable'
class Metadata
extend Forwardable
def_delegators :@hash, *Hash.instance_methods
endMaybe see how that benchmarks? Alternately, something else I've been mulling is the idea of just using a raw hash, w/o wrapping it or subclassing it or anything...and using it's Not sure it's worth the effort, though :(. Ultimately, what I care about most is getting rid of the runtime |
|
I added |
…passthrough to inner hash
|
@JonRowe -- I think I've decided against this (even though I initially got this ball rolling). Thanks for giving it a shot, though. |
I think
DelegateClassis the cause of the performance degradation you're seeing @myronmarston, give this a try. I tried doing this without directly specifying the methods but that had a similar performance failing.