Skip to content

Consider optimizing more core methods to avoid dispatch #9170

Description

@headius

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions