-
Jeremy Evans authored
Anonymous positional splats cannot be directly accessed, they can only be passed as splats to other methods. So if an anonymous positional splat would be empty, you can use a shared frozen empty array to save an allocation. ```ruby def a(*) end a() ``` This is similar to how anonymous empty keyword splats are optimized, except those use `nil` instead of a shared empty frozen hash. This updates the allocation tests to check that the array allocations are avoided where possible. It also makes a small change to test_iseq.rb to ensure an unfrozen hash is passed as the value of an anonymous splat parameter.
Jeremy Evans authoredAnonymous positional splats cannot be directly accessed, they can only be passed as splats to other methods. So if an anonymous positional splat would be empty, you can use a shared frozen empty array to save an allocation. ```ruby def a(*) end a() ``` This is similar to how anonymous empty keyword splats are optimized, except those use `nil` instead of a shared empty frozen hash. This updates the allocation tests to check that the array allocations are avoided where possible. It also makes a small change to test_iseq.rb to ensure an unfrozen hash is passed as the value of an anonymous splat parameter.
Loading