From 19bc7e4226c2fbc2ba44bdd9ed9cfeb5f40e5a9c Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Mon, 21 Nov 2022 19:03:53 -0500 Subject: [PATCH] stream: use fast-path for only large inputs --- lib/internal/streams/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/streams/utils.js b/lib/internal/streams/utils.js index 7904b4a66d1dec2..44ca7703a82fb2f 100644 --- a/lib/internal/streams/utils.js +++ b/lib/internal/streams/utils.js @@ -278,7 +278,7 @@ function isErrored(stream) { function encodeWithFastPath(input, encoding) { const enc = normalizeEncoding(encoding); - if (enc === 'utf8') { + if (enc === 'utf8' && TypedArrayPrototypeGetByteLength(input) > 512) { const buf = encoder.encode(input); return new FastBuffer( TypedArrayPrototypeGetBuffer(buf),