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

Comparison with ES7 / Babel / regenerator #31

Open
dandv opened this issue Jan 31, 2016 · 6 comments
Open

Comparison with ES7 / Babel / regenerator #31

dandv opened this issue Jan 31, 2016 · 6 comments

Comments

@dandv
Copy link

dandv commented Jan 31, 2016

https://ponyfoo.com/articles/understanding-javascript-async-await

@yortus
Copy link
Owner

yortus commented Feb 1, 2016

Yep good idea, I'd like to add this when I get a chance.

@mayeaux
Copy link

mayeaux commented Apr 3, 2016

I think it's a great idea. I have a lot of proficiency with Babel but am hoping to use this in a side project, a quick overview of differences would help a lot.

@stanleyxu2005
Copy link

stanleyxu2005 commented Apr 21, 2017

What will be the relationship of ES7? As the Node 7.x branch supports await/async natively already, I'm curious, for new application that can run in Node 7.x, is it still worthy to use awaitasync. Will it have notable performance downgrade etc. IMHO, await(function() ...) is better than the native syntax await function()....

@yortus
Copy link
Owner

yortus commented Apr 21, 2017

@stanleyxu2005 once you can use native async/await, I'd recommend migrating away from this library to the native syntax. In most cases it should be as simple as removing the extra parentheses (unless you make use of deep awaits, which aren't supported in the native syntax).

As for performance, I doubt it would matter much in real-world scenarios. Fibers (used by this lib) were much faster than ES6 generators in tight loops in V8, because V8 did not optimise generator functions. I'm not sure if that's still the case, or whether it also applies to V8's async/await. Either way any perf difference is likely to go away with ongoing V8 optimisation.

@allenhwkim
Copy link

@yortus I agree with @stanleyxu2005 await(function() ...) is better than the native syntax await function()....

@stanleyxu2005
Copy link

stanleyxu2005 commented Jun 3, 2017

@allenhwkim I think the developers can consider detect native async/await support and switch conditionally. Use native implementation for new node environment and use wrapper for old node environments. There is nothing we can do to change the async/await syntax but live with the fact. I'm now okay with it. The only thing I still not quite confident is need some tool to detect unproperly written code, otherwise I have to troubleshoot unhandled rejections in PROD environment.

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

5 participants