Truffle::Splitter.split will yield each split part if a block is provided or otherwise will collect the results into an array. These code paths were unified by creating a proc to Array#<<. This approach resulted in a new proc being allocated per call, which in turn created excessive splitting of Array#<< as reported in #3527. Since the method reference can be invoked directly, there's no need to turn it into a proc. This PR simplifies the code to eliminate that proc allocation.
Truffle::Splitter.split
will yield each split part if a block is provided or otherwise will collect the results into an array. These code paths were unified by creating a proc toArray#<<
. This approach resulted in a new proc being allocated per call, which in turn created excessive splitting ofArray#<<
as reported in #3527. Since the method reference can be invoked directly, there's no need to turn it into a proc. This PR simplifies the code to eliminate that proc allocation.