From 59a7195843edf7c16d5eb5b671090d512c383b2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Audiger?= Date: Thu, 15 Jan 2026 08:36:17 +0100 Subject: [PATCH] perf: use `BufWriter` to buffer chunks before writing file to filesystem. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémy Audiger --- crates/brioche-resources/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/brioche-resources/src/lib.rs b/crates/brioche-resources/src/lib.rs index 1a7a688..babfc4d 100644 --- a/crates/brioche-resources/src/lib.rs +++ b/crates/brioche-resources/src/lib.rs @@ -122,7 +122,8 @@ pub fn add_named_blob( if executable { blob_file_options.mode(0o777); } - let mut blob_file = blob_file_options.open(&blob_temp_path)?; + let blob_file = blob_file_options.open(&blob_temp_path)?; + let mut blob_file = std::io::BufWriter::new(blob_file); // Read the contents, both copying it to the temporary file and hashing // as we go