From f965a00e0c0504fc8543eea9a803d7a53a86c34b Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Wed, 30 Oct 2019 20:04:18 -0700 Subject: [PATCH] rtiow: buffer json output, waaay faster. --- rtiow/src/output.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rtiow/src/output.rs b/rtiow/src/output.rs index ccf9777..8c2f6af 100644 --- a/rtiow/src/output.rs +++ b/rtiow/src/output.rs @@ -1,5 +1,6 @@ use std::collections::HashMap; use std::fs::File; +use std::io::BufWriter; use std::path::Path; use std::sync::Arc; use std::sync::Mutex; @@ -189,6 +190,7 @@ pub fn write_images>( }; info!("Saving {}", binary_path.to_string_lossy()); let f = File::create(output_dir.join(binary_path))?; + let f = BufWriter::new(f); match it { ImageType::RGB01 => { serde_json::ser::to_writer( @@ -200,12 +202,12 @@ pub fn write_images>( )?; } ImageType::Grey01 | ImageType::GreyNormalized => { - // TODO(wathiede): make grey scale serde_json::ser::to_writer(f, &img.pix.iter().map(|v| v.x).collect::>())?; } }; } let f = File::create(output_dir.join("data.json"))?; + let f = BufWriter::new(f); serde_json::ser::to_writer( f, &Data {