DEV Community

Discussion on: How To Implement a Queue in JavaScript—and Beat Arrays at Their Own Game

Collapse
 
jonrandy profile image
Jon Randy 🎖️ • Edited

Array is still faster than Queue on Firefox at 150,000 enqueues/dequeues (that's as far as I tested)

Collapse
 
mattpopovich profile image
Matt Popovich • Edited

You're right! Firefox and Safari seem to handle unshifts much better than Chrome/Edge; they stay about even. I'll add a note about this.

Update: Added a note at the top about browser optimizations in Firefox & Safari, and a link to a great blog post on how SpiderMonkey optimized shift/unshift!