From 1abff073921bcb0631602032aef0135bccfaee0d Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Wed, 13 Mar 2024 20:02:14 +0100 Subject: [PATCH] stream: bump default highWaterMark This should give a performance boost accross the board. Given that the old limit is a decod old and memory capacity has doubled many times since I think it is appropriate to slightly bump the default limit. PR-URL: https://github.com/nodejs/node/pull/52037 Refs: https://github.com/nodejs/node/pull/46608 Refs: https://github.com/nodejs/node/pull/50120 Reviewed-By: Rafael Gonzaga Reviewed-By: Matteo Collina Reviewed-By: Yagiz Nizipli Reviewed-By: Chengzhong Wu Reviewed-By: Moshe Atlow Reviewed-By: Mohammed Keyvanzadeh Reviewed-By: Trivikram Kamat Reviewed-By: Ruben Bridgewater --- benchmark/net/net-c2s.js | 2 +- benchmark/net/net-pipe.js | 2 +- benchmark/net/net-s2c.js | 2 +- benchmark/net/net-wrap-js-stream-passthrough.js | 2 +- benchmark/net/tcp-raw-c2s.js | 2 +- benchmark/net/tcp-raw-pipe.js | 2 +- benchmark/net/tcp-raw-s2c.js | 2 +- doc/api/stream.md | 10 ++++++++-- lib/internal/streams/state.js | 3 ++- test/parallel/test-http-no-read-no-dump.js | 2 +- test/parallel/test-https-hwm.js | 2 +- test/parallel/test-stream-duplex-readable-end.js | 2 ++ .../test-stream-pipe-await-drain-push-while-write.js | 2 ++ test/parallel/test-stream-readable-infinite-read.js | 1 + .../test-stream-transform-split-highwatermark.js | 4 ++-- .../parallel/test-stream-transform-split-objectmode.js | 8 +++++--- test/parallel/test-tls-connect-hwm-option.js | 2 +- test/parallel/test-zlib-brotli-16GB.js | 3 ++- 18 files changed, 34 insertions(+), 19 deletions(-) diff --git a/benchmark/net/net-c2s.js b/benchmark/net/net-c2s.js index fdb0bb4968c..48e454c5815 100644 --- a/benchmark/net/net-c2s.js +++ b/benchmark/net/net-c2s.js @@ -6,7 +6,7 @@ const net = require('net'); const PORT = common.PORT; const bench = common.createBenchmark(main, { - len: [64, 102400, 1024 * 1024 * 16], + len: [64, 102400, 1024 * 64 * 16], type: ['utf', 'asc', 'buf'], dur: [5], }, { diff --git a/benchmark/net/net-pipe.js b/benchmark/net/net-pipe.js index 0b9107357ca..dd9f2de497f 100644 --- a/benchmark/net/net-pipe.js +++ b/benchmark/net/net-pipe.js @@ -6,7 +6,7 @@ const net = require('net'); const PORT = common.PORT; const bench = common.createBenchmark(main, { - len: [2, 64, 102400, 1024 * 1024 * 16], + len: [2, 64, 102400, 1024 * 64 * 16], type: ['utf', 'asc', 'buf'], dur: [5], }, { diff --git a/benchmark/net/net-s2c.js b/benchmark/net/net-s2c.js index 07c5a880692..1b9c91b8e78 100644 --- a/benchmark/net/net-s2c.js +++ b/benchmark/net/net-s2c.js @@ -5,7 +5,7 @@ const common = require('../common.js'); const PORT = common.PORT; const bench = common.createBenchmark(main, { - sendchunklen: [256, 32 * 1024, 128 * 1024, 16 * 1024 * 1024], + sendchunklen: [256, 32 * 1024, 128 * 1024, 16 * 64 * 1024], type: ['utf', 'asc', 'buf'], recvbuflen: [0, 64 * 1024, 1024 * 1024], recvbufgenfn: ['true', 'false'], diff --git a/benchmark/net/net-wrap-js-stream-passthrough.js b/benchmark/net/net-wrap-js-stream-passthrough.js index bae976ad40b..27cda28343c 100644 --- a/benchmark/net/net-wrap-js-stream-passthrough.js +++ b/benchmark/net/net-wrap-js-stream-passthrough.js @@ -5,7 +5,7 @@ const common = require('../common.js'); const { PassThrough } = require('stream'); const bench = common.createBenchmark(main, { - len: [64, 102400, 1024 * 1024 * 16], + len: [64, 102400, 1024 * 64 * 16], type: ['utf', 'asc', 'buf'], dur: [5], }, { diff --git a/benchmark/net/tcp-raw-c2s.js b/benchmark/net/tcp-raw-c2s.js index edfab797d09..5b174f50e81 100644 --- a/benchmark/net/tcp-raw-c2s.js +++ b/benchmark/net/tcp-raw-c2s.js @@ -9,7 +9,7 @@ const util = require('util'); // run the function with those settings. // if not, then queue up a bunch of child processes. const bench = common.createBenchmark(main, { - len: [102400, 1024 * 1024 * 16], + len: [102400, 1024 * 64 * 16], type: ['utf', 'asc', 'buf'], dur: [5], }, { diff --git a/benchmark/net/tcp-raw-pipe.js b/benchmark/net/tcp-raw-pipe.js index 15279b32784..fbaa21b5a30 100644 --- a/benchmark/net/tcp-raw-pipe.js +++ b/benchmark/net/tcp-raw-pipe.js @@ -9,7 +9,7 @@ const util = require('util'); // run the function with those settings. // if not, then queue up a bunch of child processes. const bench = common.createBenchmark(main, { - len: [102400, 1024 * 1024 * 16], + len: [102400, 1024 * 64 * 16], type: ['utf', 'asc', 'buf'], dur: [5], }, { diff --git a/benchmark/net/tcp-raw-s2c.js b/benchmark/net/tcp-raw-s2c.js index 7818719b728..3ca03529fce 100644 --- a/benchmark/net/tcp-raw-s2c.js +++ b/benchmark/net/tcp-raw-s2c.js @@ -9,7 +9,7 @@ const util = require('util'); // run the function with those settings. // If not, then queue up a bunch of child processes. const bench = common.createBenchmark(main, { - len: [102400, 1024 * 1024 * 16], + len: [102400, 1024 * 64 * 16], type: ['utf', 'asc', 'buf'], dur: [5], }, { diff --git a/doc/api/stream.md b/doc/api/stream.md index d5b0044d65c..ff47393766c 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -3479,6 +3479,9 @@ method.