Use ndarray's parallelism features

It's easier to read, and it also gets 10-30% perf improvement for
Driver::step
This commit is contained in:
2020-09-12 20:37:31 -07:00
parent f4cdd1240d
commit b4b0fde8af
3 changed files with 33 additions and 42 deletions

View File

@@ -291,10 +291,15 @@ impl MultiRenderer {
pub fn render(&mut self, state: &SimState, measurements: &[Box<dyn AbstractMeasurement>]) {
let max_width = 1980; //< TODO: make configurable
// let max_width = 200;
let dec = (state.width() + max_width - 1) / max_width;
let snap = state.snapshot(dec);
Renderer::render(self, &snap, measurements);
//let max_width = 100;
if state.width() > max_width {
let dec = (state.width() + max_width - 1) / max_width;
let snap = state.snapshot(dec);
// XXX: measurements are messed up by rescaling
Renderer::render(self, &snap, &[]);
} else {
Renderer::render(self, &state.snapshot(1), measurements);
}
}
}