pub struct AdaptiveBatcher { /* private fields */ }Expand description
Adaptive batch size controller.
Implementations§
Source§impl AdaptiveBatcher
impl AdaptiveBatcher
Sourcepub fn new(config: DynamicBatchConfig) -> Self
pub fn new(config: DynamicBatchConfig) -> Self
Create a new adaptive batcher.
Sourcepub fn current_batch_size(&self) -> usize
pub fn current_batch_size(&self) -> usize
Get current recommended batch size.
Sourcepub fn update(&mut self, _batch_size: usize, latency: Duration, throughput: f64)
pub fn update(&mut self, _batch_size: usize, latency: Duration, throughput: f64)
Update batch size based on observed latency.
Sourcepub fn avg_latency(&self) -> Option<Duration>
pub fn avg_latency(&self) -> Option<Duration>
Get average recent latency.
Sourcepub fn avg_throughput(&self) -> Option<f64>
pub fn avg_throughput(&self) -> Option<f64>
Get average recent throughput.
Auto Trait Implementations§
impl Freeze for AdaptiveBatcher
impl RefUnwindSafe for AdaptiveBatcher
impl Send for AdaptiveBatcher
impl Sync for AdaptiveBatcher
impl Unpin for AdaptiveBatcher
impl UnwindSafe for AdaptiveBatcher
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