Skip to content

stream: add fast-path for readable streams

I'll update benchmarks after CI machine is completed. Until then, here's my benchmark results:

                                                                             confidence improvement accuracy (*)   (**)  (***)
streams/readable-encoding.js n=1000 op='push' len=16384 encoding='latin1'                   -0.53 %       ±0.69% ±0.92% ±1.20%
streams/readable-encoding.js n=1000 op='push' len=16384 encoding='utf-8'            ***     35.45 %       ±0.74% ±0.99% ±1.28%
streams/readable-encoding.js n=1000 op='push' len=256 encoding='latin1'             ***    -10.25 %       ±2.83% ±3.76% ±4.90%
streams/readable-encoding.js n=1000 op='push' len=256 encoding='utf-8'              ***     37.38 %       ±3.19% ±4.26% ±5.56%
streams/readable-encoding.js n=1000 op='push' len=512 encoding='latin1'             ***    -10.17 %       ±2.24% ±2.98% ±3.88%
streams/readable-encoding.js n=1000 op='push' len=512 encoding='utf-8'              ***     39.90 %       ±2.39% ±3.19% ±4.17%
streams/readable-encoding.js n=1000 op='unshift' len=16384 encoding='latin1'                -0.50 %       ±0.75% ±1.00% ±1.30%
streams/readable-encoding.js n=1000 op='unshift' len=16384 encoding='utf-8'         ***     35.19 %       ±0.59% ±0.79% ±1.03%
streams/readable-encoding.js n=1000 op='unshift' len=256 encoding='latin1'          ***    -10.44 %       ±2.71% ±3.60% ±4.69%
streams/readable-encoding.js n=1000 op='unshift' len=256 encoding='utf-8'           ***     37.89 %       ±3.37% ±4.49% ±5.88%
streams/readable-encoding.js n=1000 op='unshift' len=512 encoding='latin1'          ***    -11.79 %       ±2.48% ±3.30% ±4.29%
streams/readable-encoding.js n=1000 op='unshift' len=512 encoding='utf-8'           ***     39.78 %       ±2.45% ±3.27% ±4.27%

Be aware that when doing many comparisons the risk of a false-positive result increases.
In this case, there are 12 comparisons, you can thus expect the following amount of false-positive results:
  0.60 false positives, when considering a   5% risk acceptance (*, **, ***),
  0.12 false positives, when considering a   1% risk acceptance (**, ***),
  0.01 false positives, when considering a 0.1% risk acceptance (***)

Merge request reports

Loading