3 ms·
Without digging into sources, since Node is single-threaded, that drastic a performance difference for an IO-bound task would have me looking at whether logging
by eyelidlessness 10y ago
Without digging into sources, since Node is single-threaded, that drastic a performance difference for an IO-bound task would have me looking at whether logging is synchronous. Node's APIs discourage synchronous IO, but don't prevent it.
- nprescott 10y agoZeke mentions this in the comments[0] on the article: >The console functions are synchronous when the destination is a terminal or a file (to avoid lost messages in case of premature exit) and asynchronous when it’s a pipe (to avoid blocking for long periods of time). Which still seems to be the case in the LTS[1]. [0]: http://micheljansen.org/blog/entry/1698#comment-522124 http://micheljansen.org/blog/entry/1698#comment-522124 [1]: https://nodejs.org/dist/latest-v4.x/docs/api/console.html#console_asynchronous_vs_synchronous_consoles https://nodejs.org/dist/latest-v4.x/docs/api/console.html#co...
- k__ 10y agoSo, always pipe before write?