|
@@ -85,15 +85,18 @@ impl Heap {
|
|
|
return None;
|
|
return None;
|
|
|
}
|
|
}
|
|
|
let mut pending = self.pending.lock().unwrap_or_else(|e| e.into_inner());
|
|
let mut pending = self.pending.lock().unwrap_or_else(|e| e.into_inner());
|
|
|
- let h = self
|
|
|
|
|
- .host
|
|
|
|
|
- .get_or_init(|| host::HostHeap::new(self.samplers(), self.desc.count))
|
|
|
|
|
- .as_ref()?;
|
|
|
|
|
- let step = u64::from(increment(self.desc.kind)?);
|
|
|
|
|
- for i in pending.drain(..) {
|
|
|
|
|
- h.mirror(i, self.start + u64::from(i) * step, false);
|
|
|
|
|
- }
|
|
|
|
|
- Some(h)
|
|
|
|
|
|
|
+ // A recorder can take the fast path as soon as the OnceLock is
|
|
|
|
|
+ // initialized. Publish only after replaying the queued writes.
|
|
|
|
|
+ self.host
|
|
|
|
|
+ .get_or_init(|| {
|
|
|
|
|
+ let step = u64::from(increment(self.desc.kind)?);
|
|
|
|
|
+ let h = host::HostHeap::new(self.samplers(), self.desc.count)?;
|
|
|
|
|
+ for i in pending.drain(..) {
|
|
|
|
|
+ h.mirror(i, self.start + u64::from(i) * step, false);
|
|
|
|
|
+ }
|
|
|
|
|
+ Some(h)
|
|
|
|
|
+ })
|
|
|
|
|
+ .as_ref()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// The descriptor index of `handle` in this heap, if it lies in it.
|
|
/// The descriptor index of `handle` in this heap, if it lies in it.
|