4 ms·
> Easy-to-use synchronous API (faster than an asynchronous API... yes, you read that correctly) Isn't that entirely unsurprising? The point of async is not th
by masklinn 9y ago
> Easy-to-use synchronous API (faster than an asynchronous API... yes, you read that correctly)
Isn't that entirely unsurprising?
The point of async is not that it's faster, it's that other shit can run while you do your IO. Of course your sequence of operations is faster when you never yield to other tasks.
- gwbas1c 9y agoUhhh, read the description. node-sqlite3 uses an asynchronous API for CPU-bound functions. An asynchronous API is only for IO-bound functions. CPU-bound functions should be synchronous.
- deleted 9y ago[deleted]
- Klathmon 9y agoWell even CPU-bound async functions can have benefits in node.js as they can free up the single javascript thread to do other work while it does the CPU bound work on another thread in the native code. It's definitely a bastardization of the terms a bit, but at its core it's basically a message-passing multi-process system that hides the implementation behind the well-understood (to most programmers that use node) async i/o
- always_good 9y agoWell, CPU-bound work should be done off the event loop thread when means out of process in Node which introduces an I/O boundary and thus an async call.