News for hackers. Stuff that matters.
Re:Better-sqlite3: A faster Sqlite library for Node.js by matharmin on Monday March 19, 2018 @11:38AM (#16619227)
Would it work to use a Web Worker as the separate process? (Seems simpler than using a separate process with websockets).
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.
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."

https://nodejs.org/api/cli.html#cli_uv_threadpool_size_size

Re:Better-sqlite3: A faster Sqlite library for Node.js by Can_Not on Tuesday March 20, 2018 @10:49AM (#16629022)
You actually can use child_process to make a worker thread, although it would make more sense to just have an async API.
Re:Better-sqlite3: A faster Sqlite library for Node.js by matharmin on Monday March 19, 2018 @06:12PM (#16623733)
Node doesn't by itself, but Electron does, and you may be able to use node modules such as a sqlite one inside it.