stream: fix sync write perf regression
While https://github.com/nodejs/node/pull/31046 did make async writes faster it at the same time made sync writes slower.
This PR corrects this while maintaining performance improvements.
streams/writable-manywrites.js callback='no' writev='no' sync='no' n=2000000 2.55 % ±3.61% ±4.81% ±6.26%
streams/writable-manywrites.js callback='no' writev='no' sync='yes' n=2000000 *** 7.46 % ±3.52% ±4.69% ±6.10%
streams/writable-manywrites.js callback='no' writev='yes' sync='no' n=2000000 4.13 % ±4.74% ±6.34% ±8.32%
streams/writable-manywrites.js callback='no' writev='yes' sync='yes' n=2000000 3.91 % ±4.16% ±5.53% ±7.20%
streams/writable-manywrites.js callback='yes' writev='no' sync='no' n=2000000 * 3.91 % ±3.09% ±4.11% ±5.36%
streams/writable-manywrites.js callback='yes' writev='no' sync='yes' n=2000000 *** 24.84 % ±3.67% ±4.89% ±6.36%
streams/writable-manywrites.js callback='yes' writev='yes' sync='no' n=2000000 2.69 % ±6.09% ±8.13% ±10.64%
streams/writable-manywrites.js callback='yes' writev='yes' sync='yes' n=2000000 *** 12.66 % ±3.47% ±4.62% ±6.01%
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines