Re:Better-sqlite3: A faster Sqlite library for Node.js
by jlongster on Monday March 19, 2018 @01:03PM
(#16620148)
Node doesn't have "web workers", so I'm not sure what you mean. Node doesn't come with threading support as far as I know; it's single-threaded by design, but there may be libraries that try to implement it.
[ Parent
| on HN ]
Re:Better-sqlite3: A faster Sqlite library for Node.js
by erulabs on Monday March 19, 2018 @04:54PM
(#16623063)
Node does in fact come with "threading support", just in a non-obvious way (and not exactly exposed to the end-user). It depends on what module you're talking about, but libuv in general _does_ use a worker pool. For example, the "fs" module will, under the hood, make use of a thread pool. The "http" module use a different strategy depending on the operating system, etc.
"Asynchronous system APIs are used by Node.js whenever possible, but where they do not exist, libuv's threadpool is used to create asynchronous node APIs based on synchronous system APIs."