You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I benchmarked 3 ways for invoking a closure on an object instance using instance_exec, define_singleton_method and define_method and found out that using define_method is ~10x faster. See https://gist.github.com/colinsurprenant/5869685
AFAIK these 3 ways of invoking a closure should be semantically equivalent?! as such there might be room for optimization on instance_exec?
Note that results are similar with MRI 2.0.0p195.
The text was updated successfully, but these errors were encountered:
as per discussion with @headius https://twitter.com/headius/status/349951285295980544 I am reporting this performance oddity.
I benchmarked 3 ways for invoking a closure on an object instance using
instance_exec
,define_singleton_method
anddefine_method
and found out that usingdefine_method
is ~10x faster. See https://gist.github.com/colinsurprenant/5869685AFAIK these 3 ways of invoking a closure should be semantically equivalent?! as such there might be room for optimization on instance_exec?
Note that results are similar with MRI 2.0.0p195.
The text was updated successfully, but these errors were encountered: