From fd434b81d94c97c3d183f8405f166194fc10bb43 Mon Sep 17 00:00:00 2001 From: rein Date: Tue, 18 Feb 2025 13:54:12 +0000 Subject: [PATCH] for better memory efficiency this change improves performance for large buffer writes and eliminates unnecessary memory allocation and copying --- jsbits/process.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsbits/process.js b/jsbits/process.js index a511f34c..2d9c7f10 100644 --- a/jsbits/process.js +++ b/jsbits/process.js @@ -90,7 +90,7 @@ function h$process_pipeFd(pipe, write) { c(-1); return; } - var nbuf = buf.u8.slice(buf_offset, buf_offset+n); + var nbuf = new Uint8Array(buf.u8.buffer, buf_offset, n); var r = pipe.write(nbuf, function() { TRACE_PROCESS("pipe", fd, "flushed"); c(n);