On Sat, Feb 24, 2018 at 1:45 PM, Turner, Kevin (ELS-CON) <
kevin@xxxxxxxxxxxxxx> wrote:
"await comes with a performance penalty" ??
What performance penalty Henrik?
I was just reviewing old discussions and came across this.
I've read that various implementations of promise-callback functionality
offer varying performance characteristics. Those comparisons are like a
factor of 1 (say 100% degradation or improvement).
The real performance concern however is when you compare async-await
functions vs. other language environments such a Python where functions
perform I/O synchronously as opposed to using an "await" to periodically
relinquish control to the Node.js event loop.
Synchronous functions in other language environments may provide something
like 25 times better performance than asynchronous functions in Node.js.
That makes sense to me. Node.js performs concurrency services within its
event loop as opposed to other architectures that rely on the underlying OS
to perform services like task swapping. Every time a Javascript function
relinquishes control to Node's event loop via the await keyword, Node will
perform its concurrency operations (through the event-loop cycle). That can
add a lot of latency that synchronous architectures don't run into.
As an Amazon Associate we earn from qualifying purchases.