Prompted by #9056. See https://bugs.ruby-lang.org/issues/6638 for a CRuby issue that led to a similar change there.
Unshift should not only shift elements over by one when reallocating, since that will force every future unshift to copy all elements every time. If a user does unshift once, they are likely to do additional unshifts (or at least less likely to push values at the end), so make sure the expanded space accommodates that use case.
Prompted by #9056. See https://bugs.ruby-lang.org/issues/6638 for a CRuby issue that led to a similar change there.
Unshift should not only shift elements over by one when reallocating, since that will force every future unshift to copy all elements every time. If a user does unshift once, they are likely to do additional unshifts (or at least less likely to push values at the end), so make sure the expanded space accommodates that use case.