S Gregory Brown [MOVED, SEE BIO] @skillstopractice.com · Mar 11

No idea the performance characteristics of this, but after reviewing the Array methods and coming up empty, I attempted this just out of curiosity. (The single pop gets rid of the trailing nil)

1 likes 2 replies

?

Replies

Thomas Leitner · Mar 11

Ah, I forgot up that - thank you! You can further optimize it by using a constant empty array and doing `array[from, size] = EMPTY_ARRAY`. I did a benchmark comparing pop, slice! and your method using benchmark-driver. Interestingly pop was faster even though it creates arrays.

Лінія Маннергейма · Mar 11

didn't look at the comments, but did almost the same, lol