-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
doc: note JavaScript is not single threaded #6848
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
If I recall this document was a port of the original guide written many years ago, so not sure who even wrote this initially. |
Lighthouse Results
|
Unit Test Coverage ReportUnit Test Report
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I wonder if there's a better way to describe this. What happens in Node.js currently is:
To emphasize that one can spawn threads from JS, maybe it's clearer to just mention Workers. But when we are talking about event loops, they do have a 1-1 correspondance with JS threads (each worker gets their own event loop). Or we can just drop "despite the fact that JavaScript is single-threaded" completely since it's not exactly clear what this is talking about in this context. |
@benjamingr, you are correct because the language itself can not be described as single nor multi-thread because these specifications have to do with its interpreters and runners. But I think the usage in this document could be because currently, many programmers associate the language to its interpreter. To me, it would be better if we say that Node.js not JavaScript is single-thread. |
This PR will need to be rebased or recreated now that #6850 merged. |
That's also not true (e.g. https://nodejs.org/api/worker_threads.html :D ). We can add Node.js executes a single thread of user JavaScript unless other threads are explicitly created by the user or libraries, not sure that helps. @bmuenzenmeyer I'm not sure what that means feel free to edit this branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as it is, I think this resource could do with a little cleaning.
Honestly I appreciate the effort and don't have time to go over the whole thing but there are plenty of inaccuracies in this document. This PR fixes the first one I noticed - JavaScript as a language is _not_ single threaded. Nor has it ever been, and multithreaded JavaScript execution dates back at least 10-20 years Signed-off-by: Benjamin Gruenbaum <benjamingr@gmail.com>
b2827ba
to
91ded2b
Compare
Honestly I appreciate the effort and don't have time to go over the whole thing but there are plenty of inaccuracies in this document.
This PR fixes the first one I noticed - JavaScript as a language is not single threaded. Nor has it ever been, and multithreaded JavaScript execution dates back at least 10-20 years
Description
Validation
Related Issues
Check List
npm run format
to ensure the code follows the style guide.npm run test
to check if all tests are passing.npx turbo build
to check if the website builds without errors.