Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microtask queue can be made faster #59

Open
Pauan opened this issue Apr 24, 2015 · 4 comments
Open

Microtask queue can be made faster #59

Pauan opened this issue Apr 24, 2015 · 4 comments

Comments

@Pauan
Copy link
Contributor

Pauan commented Apr 24, 2015

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.

@kriskowal
Copy link
Owner

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.

@kriskowal
Copy link
Owner

I am interested in simplifying ASAP based on this insight. Pull requests welcome for benchmark or simplification of the queue.

@Pauan
Copy link
Contributor Author

Pauan commented May 25, 2015

Okay, how would I (or anybody else) go about submitting a benchmark to this repository?

@kriskowal
Copy link
Owner

@Pauan I am open to nearly anything. We can refine as we go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants