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.
The
begLenIntmethod inRubyRangereturns 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.