Skip to content

stream: refactor the objectMode assignment logic

~7% improvement. reduce repetitive judgments when options is undefined.

 streams/creation.js kind='duplex' n=50000000                    0.85 %      ±3.68% ±4.90% ±6.37%
 streams/creation.js kind='readable' n=50000000         ***      6.89 %      ±3.93% ±5.25% ±6.85%
 streams/creation.js kind='transform' n=50000000                 0.17 %      ±4.49% ±5.99% ±7.82%
 streams/creation.js kind='writable' n=50000000                 -1.35 %      ±3.37% ±4.48% ±5.84%

/cc @ronag

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Merge request reports

Loading