Skip to content

Commit

Permalink
stream: use fast-path for only large inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Nov 22, 2022
1 parent 7013248 commit 19bc7e4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/internal/streams/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 19bc7e4

Please sign in to comment.