3 ms·
As a performance optimization I use stderr instead of console.log, for some reason stderr is much faster then stdout :P And console.log is slow as hell, mostly
by z3t4 7y ago
As a performance optimization I use stderr instead of console.log, for some reason stderr is much faster then stdout :P And console.log is slow as hell, mostly because it's sync, but also because it does a ton of stuff; parsing the parameters, etc.
- m45t3r 7y agoIt is not that stderr is faster, it is that it is unbuffered by default (while stdout is buffered by default). If you flush your output after printing to stdout, you should get a similar result. And well, I am thinking you're talking about "much faster" for small amount of text (small enough to not fill the stdout buffer). Actually printing huge amount of text to stdout should be much faster than printing to stderr exactly because of this buffer.