CRuby optimizes several zero-arg method calls like #size and #length by short-circuiting if the target is a known core type and the method has not been redefined.
The original optimization dates all the way back to Ruby 1.9.2 but has expanded over the years: ruby/ruby@f825d84
This may or may not be a useful optimization for us, since these trivial calls will typically inline very well and eliminate all dispatch overhead.
We should explore whether we can improve performance of these methods by having a short-circuited path, and audit the other vm_opt_* optimizations for similar cases.
CRuby optimizes several zero-arg method calls like
#sizeand#lengthby short-circuiting if the target is a known core type and the method has not been redefined.The original optimization dates all the way back to Ruby 1.9.2 but has expanded over the years: ruby/ruby@f825d84
This may or may not be a useful optimization for us, since these trivial calls will typically inline very well and eliminate all dispatch overhead.
We should explore whether we can improve performance of these methods by having a short-circuited path, and audit the other
vm_opt_*optimizations for similar cases.