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

Using standard iterators #1

Open
Yomguithereal opened this issue Mar 17, 2017 · 1 comment
Open

Using standard iterators #1

Yomguithereal opened this issue Mar 17, 2017 · 1 comment

Comments

@Yomguithereal
Copy link

Yomguithereal commented Mar 17, 2017

Hello @acarl005. Thanks for the awesome library. Would you consider switching from generators (using the yield keyword) to basic JS iterators (just the object with the next function & following JS iterator protocol) so that it remains possible to use your library with more old-school JS engines (+ attaching Symbol.iterator so that your API remains totally unchanged)?

I could help you achieve that by recoding the necessary parts if you'd like.

As a side note, I am wondering whether you attempted to benchmark generators vs. iterator protocol and if you went for generators for obvious performance reasons I missed.

Have a good day.

@acarl005
Copy link
Owner

@Yomguithereal I'm not really interested in supporting older JS engines. There are many other libraries to choose from if the engine doesn't have generators.

Yeah I did run benchmarks on one function that I re-wrote to use the plain iterator protocol. It was on Node v6.0.0 and generators were a little over 2 times slower. But I ran them again when Node v7 came out and they are nearly the same. I trust that generators will become more optimized over time.

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

No branches or pull requests

2 participants