You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have created a jsperf for queues. drain_Array is a naive Array.prototype.shift, drain_ArrayQueue is asap's optimization, and drain_Queue uses an implementation of Queues that has O(1) push and amortized O(1) pull.
With my machine, using Google Chrome, asap's optimization for array removal ends up being significantly slower than a naive shift! It seems likely that Chrome already optimizes shift (possibly using a similar technique that asap uses).
The Queue implementation is roughly the same speed as naive shift, but it should be consistently fast on all browsers (even those that don't optimize shift).
Of course, it is possible that I messed up in making the test, and that the results are incorrect.
The text was updated successfully, but these errors were encountered:
First step would be to build a benchmark. If someone provides a PR for a bench, I can measure across all the SauceLabs configurations and get some data.
I have created a jsperf for queues.
drain_Array
is a naiveArray.prototype.shift
,drain_ArrayQueue
is asap's optimization, anddrain_Queue
uses an implementation of Queues that has O(1) push and amortized O(1) pull.With my machine, using Google Chrome, asap's optimization for array removal ends up being significantly slower than a naive shift! It seems likely that Chrome already optimizes shift (possibly using a similar technique that asap uses).
The Queue implementation is roughly the same speed as naive shift, but it should be consistently fast on all browsers (even those that don't optimize shift).
Of course, it is possible that I messed up in making the test, and that the results are incorrect.
The text was updated successfully, but these errors were encountered: