pub struct BatchCostParams {
pub c_overhead_us: f64,
pub c_per_patch_us: f64,
pub c_latency_us: f64,
pub total_patches: u64,
}Expand description
Parameters for the patch batching cost model.
Fields§
§c_overhead_us: f64Per-batch overhead in µs (GPU command buffer setup, draw call).
c_per_patch_us: f64Per-patch processing cost in µs (cell serialization + copy).
c_latency_us: f64Latency cost per deferred patch in µs (visual staleness).
total_patches: u64Total patches to process in the frame.
Implementations§
Source§impl BatchCostParams
impl BatchCostParams
Sourcepub fn total_cost(&self, batch_size: u64) -> f64
pub fn total_cost(&self, batch_size: u64) -> f64
Total cost for a given batch size k.
J(k) = ceil(n/k) × (c_overhead + k × c_per_patch) + (k−1) × c_latencySourcepub fn evaluate(&self, batch_size: u64) -> BatchCostPoint
pub fn evaluate(&self, batch_size: u64) -> BatchCostPoint
Evaluate a single point.
Sourcepub fn optimal_batch_size(&self) -> u64
pub fn optimal_batch_size(&self) -> u64
Compute optimal batch size.
The continuous optimum from dJ/dk = 0 is:
k* = sqrt(n × c_overhead / c_latency)Because ceil(n/k) creates discontinuities, the true discrete
optimum is found by enumerating candidate batch sizes at all
points where ceil(n/k) changes value. There are at most
O(sqrt(n)) such candidates.
Sourcepub fn optimize(&self) -> BatchCostResult
pub fn optimize(&self) -> BatchCostResult
Run the full optimization and produce evidence.
Trait Implementations§
Source§impl Clone for BatchCostParams
impl Clone for BatchCostParams
Source§fn clone(&self) -> BatchCostParams
fn clone(&self) -> BatchCostParams
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BatchCostParams
impl Debug for BatchCostParams
Auto Trait Implementations§
impl Freeze for BatchCostParams
impl RefUnwindSafe for BatchCostParams
impl Send for BatchCostParams
impl Sync for BatchCostParams
impl Unpin for BatchCostParams
impl UnsafeUnpin for BatchCostParams
impl UnwindSafe for BatchCostParams
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more