Skip to content

Improve perf of RubyRange.begLenInt #9605

Description

@headius

The begLenInt method in RubyRange returns the coerced begin and length as an int[2]. This is an extra allocation that could be eliminate by simply packing both values into a long as ((long) begin << 32) | length, or it could be turned into a record that can eventually become a value object and allocation-free.

This method is used for some common slicing methods in String and Array and eliminating the extra allocation could improve code on that hot path.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions