Get the latest tech news
Array.shift Optimizations in Firefox's JavaScript Engine (2020)
When working with arrays in Javascript, there's two sets of functions if you want to add or remove items to an array to a certain end of the array. shift/ unshift: remove / add items at the front of the array.
Thinking about this algorithm simply, it does not scale as you would need to traverse a large amount of data every time you ran array.shift(). Chrome has a similar algorithm, but it only works for arrays under size of ~50k items (A story for another day). So in the end, shift wasn't going to pan out when working with large arrays in this case, but the sleuthing I did provided an example that programming language specifications and implementations can differ and give the creative freedoms for the engineers building these runtimes or compilers to highly optimize these internal functions to great extents.
Or read this on Hacker News