Skip to content

Commit 6f1f8d4

Browse files
author
Ruben Bridgewater
committed
Separate big buffer multiplier and offset balancing
1 parent 09277ff commit 6f1f8d4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/parser.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,10 @@ function concatBuffer (parser, length) {
348348
var pos = bufferOffset
349349
length -= parser.offset
350350
if (bufferPool.length < length + bufferOffset) {
351-
// Increase the bufferPool size by three times the current needed length
352-
var multiplier = 3
353-
if (bufferOffset > 1024 * 1024 * 200) {
351+
// Increase the bufferPool size
352+
var multiplier = length > 1024 * 1024 * 75 ? 2 : 3
353+
if (bufferOffset > 1024 * 1024 * 120) {
354354
bufferOffset = 1024 * 1024 * 50
355-
multiplier = 2
356355
}
357356
bufferPool = new Buffer(length * multiplier + bufferOffset)
358357
bufferOffset = 0

0 commit comments

Comments
 (0)