Copies the values into an array of the same kind of twice the length, the added positions
left at zero. A typed array cannot be resized, so a buffer that fills up has to allocate a
longer one and copy into it; doubling is what keeps the total cost of filling a buffer of
unknown size linear. An empty array becomes one element long, so that doubling it repeatedly
makes progress.
Copies the values into an array of the same kind of twice the length, the added positions left at zero. A typed array cannot be resized, so a buffer that fills up has to allocate a longer one and copy into it; doubling is what keeps the total cost of filling a buffer of unknown size linear. An empty array becomes one element long, so that doubling it repeatedly makes progress.