Skip to content

Commit

Permalink
Experiment: removing shrink_to_fit calls to avoid reallocation.
Browse files Browse the repository at this point in the history
  • Loading branch information
thebracket committed Oct 28, 2024
1 parent 3f39be9 commit dca983b
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)) => {
Expand Down
3 changes: 0 additions & 3 deletions src/rust/lqosd/src/throughput_tracker/tracking_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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();
}
}

Expand Down Expand Up @@ -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> {
Expand Down
1 change: 0 additions & 1 deletion src/rust/lts_client/src/collector/collation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,4 @@ pub(crate) async fn collate_stats(comm_tx: Sender<SenderChannelMessage>) {

// Clear the collection buffer
writer.clear();
writer.shrink_to_fit();
}
1 change: 0 additions & 1 deletion src/rust/lts_client/src/submission_queue/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ pub(crate) async fn send_queue(stream: &mut TcpStream) -> Result<(), QueueError>
}

lock.clear();
lock.shrink_to_fit();
Ok(())
}

Expand Down

0 comments on commit dca983b

Please sign in to comment.