mirror of
https://gitea.tendokyu.moe/beerpsi/fsdecrypt.git
synced 2026-10-11 00:48:11 +03:00
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:
+4
-1
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user