mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2024-11-25 01:30:17 -06:00
Experiment: removing shrink_to_fit calls to avoid reallocation.
This commit is contained in:
parent
3f39be9590
commit
dca983b757
@ -60,7 +60,6 @@ impl TimeBuffer {
|
||||
let one_minute_ago = now - 60;
|
||||
let mut buffer = self.buffer.lock().unwrap();
|
||||
buffer.retain(|v| v.time > one_minute_ago);
|
||||
buffer.shrink_to_fit();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,6 @@ impl FlowActor {
|
||||
let since_boot = Duration::from(now);
|
||||
let expire = (since_boot - Duration::from_secs(30)).as_nanos() as u64;
|
||||
flows.flow_rtt.retain(|_, v| v.last_seen > expire);
|
||||
flows.flow_rtt.shrink_to_fit();
|
||||
}
|
||||
}
|
||||
Ok(FlowCommands::RttMap(reply)) => {
|
||||
|
@ -344,7 +344,6 @@ impl ThroughputTracker {
|
||||
let _ = sender.send((key.clone(), (d.0.clone(), d.1.clone())));
|
||||
}
|
||||
}
|
||||
all_flows_lock.shrink_to_fit();
|
||||
|
||||
let ret = lqos_sys::end_flows(expired_keys);
|
||||
if let Err(e) = ret {
|
||||
@ -355,7 +354,6 @@ impl ThroughputTracker {
|
||||
// Cleaning run
|
||||
all_flows_lock.retain(|_k,v| v.0.last_seen >= expire);
|
||||
expire_rtt_flows();
|
||||
self.raw_data.shrink_to_fit();
|
||||
}
|
||||
}
|
||||
|
||||
@ -405,7 +403,6 @@ impl ThroughputTracker {
|
||||
|
||||
pub(crate) fn next_cycle(&self) {
|
||||
self.cycle.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
|
||||
self.raw_data.shrink_to_fit();
|
||||
}
|
||||
|
||||
pub(crate) fn bits_per_second(&self) -> DownUpOrder<u64> {
|
||||
|
@ -144,5 +144,4 @@ pub(crate) async fn collate_stats(comm_tx: Sender<SenderChannelMessage>) {
|
||||
|
||||
// Clear the collection buffer
|
||||
writer.clear();
|
||||
writer.shrink_to_fit();
|
||||
}
|
||||
|
@ -98,7 +98,6 @@ pub(crate) async fn send_queue(stream: &mut TcpStream) -> Result<(), QueueError>
|
||||
}
|
||||
|
||||
lock.clear();
|
||||
lock.shrink_to_fit();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user