3 ms·
Wasn't Node's big draw early on (aside from the fact that it's JavaScript) the fact that everything is supposed to be asynchronous? I'm actually surprised this
by ARussell 11y ago
Wasn't Node's big draw early on (aside from the fact that it's JavaScript) the fact that everything is supposed to be asynchronous? I'm actually surprised this is a problem.
- mobiuscog 11y agoasynchronous doesn't magically make CPU-intensive tasks faster.
- kornish 11y agoCorrect, but it sure does stop your entire single-threaded process from blocking to the detriment of all other requests.
- corobo 11y agoIt does mean other tasks (e.g. serving pages to visitors) can still be run at the same time as the CPU-intensive task though, like most languages do when it comes to hashing passwords and logging people in
- sotojuan 11y agoEverything is asynchronous but the linked article uses the synchronous versions of the functions for some reason... async versions exist and are recommended[1] [1] https://github.com/ncb000gt/node.bcrypt.js#async-recommended https://github.com/ncb000gt/node.bcrypt.js#async-recommended
- zwily 11y agoDo the async methods actually execute on a thread pool though? Or do they use enough async methods internally to periodically release the main thread enough to keep it responsive? From a quick glance at the source, the answer to the first is no.