Skip to content

lib: print to stdout/stderr directly instead of using console

lib: print to stdout/stderr directly instead of using console

This patch adds an internal function that prints to stdout or stderr by directly writing to the known file descriptor, and uses it internally in common cases to avoid the overhead of the console implementation.

benchmark: add benchmark for node -p

Local benchmark results

                                             confidence improvement accuracy (*)   (**)  (***)
 misc/print.js code='"string"' dur=1                ***     10.26 %       ±1.70% ±2.26% ±2.94%
 misc/print.js code='1' dur=1                       ***     10.92 %       ±1.46% ±1.94% ±2.52%
 misc/print.js code='process.versions' dur=1        ***      9.51 %       ±1.71% ±2.28% ±2.98%
 misc/print.js code='process' dur=1                 ***     11.34 %       ±1.71% ±2.27% ±2.96%
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Merge request reports

Loading