4 ms·
It's not correct? Is there any reason not to use the Sync functions if you're not writing a web server and don't particularly care for performance?
by Zarel 11y ago
It's not correct?
Is there any reason not to use the Sync functions if you're not writing a web server and don't particularly care for performance?
- joepie91_ 11y agoIt is indeed not correct. They are not functionally equivalent to their asynchronous equivalents at all - your entire event loop will be blocked for the full duration of the operation. This may sound like "not a big deal", but even an operation that takes 1ms will cause noticeable lag at ~50 operations per second, and block everything approaching a thousand. For emphasis: they block the entire event loop. Not a single request, not a single client, not a single operation or event. The entire application for every user everywhere.
- deleted 11y ago[deleted]
- deleted 11y ago[deleted]
- deleted 11y ago[deleted]
- swang 11y agoIf it's your own thing, do whatever you want. But the only thing sync should be used is to exec shell scripts in node.js. sync functions are bad otherwise in any kind of production environment.