rtiow: buffer json output, waaay faster.
This commit is contained in:
parent
6bd29a2152
commit
f965a00e0c
@ -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<P: AsRef<Path>>(
|
||||
};
|
||||
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<P: AsRef<Path>>(
|
||||
)?;
|
||||
}
|
||||
ImageType::Grey01 | ImageType::GreyNormalized => {
|
||||
// TODO(wathiede): make grey scale
|
||||
serde_json::ser::to_writer(f, &img.pix.iter().map(|v| v.x).collect::<Vec<f32>>())?;
|
||||
}
|
||||
};
|
||||
}
|
||||
let f = File::create(output_dir.join("data.json"))?;
|
||||
let f = BufWriter::new(f);
|
||||
serde_json::ser::to_writer(
|
||||
f,
|
||||
&Data {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user