Skip to content

Commit 90603fc

Browse files
committed
stream: default hwm based on Buffer.poolSize
Slightly increase default Buffer.poolSize and make streams default HWM correspond to Buffer.poolSize.
1 parent 4d82b9e commit 90603fc

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/buffer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ const constants = ObjectDefineProperties({}, {
140140
}
141141
});
142142

143-
Buffer.poolSize = 8 * 1024;
143+
Buffer.poolSize = 16 * 1024;
144144
let poolSize, poolOffset, allocPool;
145145

146146
const encodingsMap = ObjectCreate(null);

lib/internal/streams/state.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const {
44
MathFloor,
55
NumberIsInteger,
66
} = primordials;
7+
const { Buffer } = require('buffer');
78

89
const { ERR_INVALID_ARG_VALUE } = require('internal/errors').codes;
910

@@ -13,7 +14,7 @@ function highWaterMarkFrom(options, isDuplex, duplexKey) {
1314
}
1415

1516
function getDefaultHighWaterMark(objectMode) {
16-
return objectMode ? 16 : 16 * 1024;
17+
return objectMode ? 16 : Buffer.poolSize;
1718
}
1819

1920
function getHighWaterMark(state, options, duplexKey, isDuplex) {

0 commit comments

Comments
 (0)