How is Node.js inherently faster when it still relies on Threads internally?

前端 未结 6 1675
野性不改
野性不改 2020-11-29 14:30

I just watched the following video: Introduction to Node.js and still don\'t understand how you get the speed benefits.

Mainly, at one point Ryan Dahl (Node.js\' cre

6条回答
  •  被撕碎了的回忆
    2020-11-29 14:47

    Threads are used only to deal with functions having no asynchronous facility, like stat().

    The stat() function is always blocking, so node.js needs to use a thread to perform the actual call without blocking the main thread (event loop). Potentially, no thread from the thread pool will ever be used if you don't need to call those kind of functions.

提交回复
热议问题