diff --git a/crates/coremem/src/driver.rs b/crates/coremem/src/driver.rs index a4afb2a..d4ce92b 100644 --- a/crates/coremem/src/driver.rs +++ b/crates/coremem/src/driver.rs @@ -282,7 +282,7 @@ where trace!("step begin"); self.diag.instrument_step(steps_this_time as u64, || { - self.state.step_multiple(steps_this_time, &*stim); + self.state.step_multiple(steps_this_time, &stim); }); trace!("step end"); @@ -456,7 +456,7 @@ struct StimAccess { /// queue)? /// A.K.A. "can i safely do a blocking recv on response_channel". outstanding: Cell, - worker: JobPool<(SimMeta, u64), (SimMeta, u64, Box>)>, + worker: JobPool<(SimMeta, u64), (SimMeta, u64, RenderedStimulus)>, } impl StimAccess { @@ -483,7 +483,7 @@ impl StimAccess { /// waits for an outstanding job (if any). /// if the response matches the request, return the response, /// else discard the response. - fn maybe_wait_for_job(&self, meta: SimMeta, step: u64) -> Option>> { + fn maybe_wait_for_job(&self, meta: SimMeta, step: u64) -> Option> { if !self.outstanding.get() { return None; } @@ -501,7 +501,7 @@ impl StimAccess { } impl + Send + 'static> StimAccess { - fn get_for(&mut self, meta: SimMeta, step: u64) -> Box> { + fn get_for(&mut self, meta: SimMeta, step: u64) -> RenderedStimulus { // either claim the outstanding job (if it exists and matches)... self.maybe_wait_for_job(meta, step).unwrap_or_else(|| { // or start a job and wait for it to complete inline @@ -529,14 +529,13 @@ impl + Send + 'static> StimAccess { let stim = diag.instrument_stimuli(|| { let stim = stim.lock().unwrap(); let opt = stim.optimized_for(meta, step); - // TODO: remove this box. RenderedStimulus is already heap allocated, so no perf diff? - Box::new(opt.as_ref().rendered( + opt.as_ref().rendered( meta.time_step().cast(), // TODO: convert this to an integer meta.time_step().cast::() * R::from_primitive(step), meta.feature_size().cast(), meta.dim() - ).into_owned()) + ).into_owned() //^ this 'into_owned' ought to be a no-op. //^ it would only ever be borrowed if we accidentally called `rendered` twice. });