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

Add a better explanation about parallel. #732

Closed
DaAwesomeP opened this issue Mar 14, 2015 · 3 comments
Closed

Add a better explanation about parallel. #732

DaAwesomeP opened this issue Mar 14, 2015 · 3 comments
Labels

Comments

@DaAwesomeP
Copy link

I recently found that async doesn't run things in parallel at all. It isn't async to blame; it is NodeJS. Async takes advantage NodeJS's non-blocking feature. So, when one task idles or pauses, another jumps in. Async manages that; it manages what jumps in. Nothing ever really happens at the same time. You would need child processes or threads for that.

I stumbled upon this with this Stack Overflow answer. I was testing my app and only using console.log and standard JavaScript functions that happen in an instant in async.each(). The console showed that the each was actually maintaining the order of the array. I had always thought that things were happening at the same time. Some were directed instantly to console.log while others had to go through if statements before console.log. I expected some to finish first.

Since async may be the first library that many people new to NodeJS learn (including me), it should be made clear how async's parallel and series works.

@DaAwesomeP
Copy link
Author

@caolan would you consider this?

@aearly
Copy link
Collaborator

aearly commented Mar 22, 2015

A PR that clarifies the docs might be welcome.

@DaAwesomeP
Copy link
Author

Thank you. I never got around to doing it.

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

No branches or pull requests

2 participants