stream: improve write performance
This is inspired by #30710.
Depends on #30733 (which is included).
Improves performance of write
by avoiding process.nextTick
and a number of conditions when possible in the hot path in sync mode.
```
confidence improvement accuracy (*) (**) (***)
streams/writable-manywrites.js n=2000000 *** 1085.31 % ±19.19% ±25.86% ±34.31%
````
EDIT: A bit more modest improvement after #30710
confidence improvement accuracy (*) (**) (***)
streams/writable-manywrites.js sync='no' n=2000000 0.10 % ±1.46% ±1.94% ±2.54%
streams/writable-manywrites.js sync='yes' n=2000000 *** 8.43 % ±1.73% ±2.30% ±3.00%
Note since #30733 is probably semver major, this should be the same.
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