perf-buf-size (#2)

Increased IO throughput when laying out VHD file

`std::io::copy` will only setup an 8KiB stack buffer, which results sub optimal performance when passing `File` directly.

Reviewed-on: https://gitea.tendokyu.moe/beerpsi/fsdecrypt/pulls/2
Co-authored-by: 莯凛 <mokurin000@gmail.com>
Co-committed-by: 莯凛 <mokurin000@gmail.com>
This commit is contained in:
莯凛
2025-11-04 05:53:17 +00:00
committed by beerpsi
parent ece90ebb5b
commit 8c5998a85c
3 changed files with 199 additions and 185 deletions
+4 -1
View File
@@ -142,6 +142,7 @@ fn extract_internal_vhd(image_path: &Path, sequence_number: u8) -> Result<PathBu
let mut data_value = data_attribute.value(&mut fs)?.attach(&mut fs);
let mut output_file = File::create(&output_path)?;
let mut writer = BufWriter::with_capacity(256 * 1024, &mut output_file);
let pb = ProgressBar::new_spinner()
.with_style(ProgressStyle::default_bar().template("{prefix} {spinner}")?);
@@ -151,7 +152,9 @@ fn extract_internal_vhd(image_path: &Path, sequence_number: u8) -> Result<PathBu
));
pb.enable_steady_tick(Duration::from_millis(100));
std::io::copy(&mut data_value, &mut output_file)?;
std::io::copy(&mut data_value, &mut writer)?;
writer.flush()?;
drop(writer);
pb.finish();