I'm implementing some code that calls the same method multiple times
from C. I'd like to cache the method to avoid costly method lookup. Is
this possible?
Something like
METHOD * m = rb_method_lookup(object, rb_intern("doit"));
rb_invoke(m, args...)
Is any such thing possible?
Thanks
Samuel
You can use rb_obj_method (just like you would use #method in pure ruby).
I'd measure first that this is your actual bottleneck before you go an optimize a tenth of a percent away.
···
On Nov 29, 2016, at 03:30, Samuel Williams <space.ship.traveller@gmail.com> wrote:
I'm implementing some code that calls the same method multiple times
from C. I'd like to cache the method to avoid costly method lookup. Is
this possible?
Something like
METHOD * m = rb_method_lookup(object, rb_intern("doit"));
rb_invoke(m, args...)