In running performance benchmarks on Array#push()
and Array#unshift()
, push vastly outperforms unshift, and the running time seems tied to the length of the array. This performance gap seems to be apparent across browsers.
Given the difference, I'm curious to know what types of data structures do V8 and OdinMonkey use to represent arrays, and how that prevents an unshift operation that runs in O(1) time.