Allocating with capacity

This commit is contained in:
Marco De Araujo 2025-12-26 09:33:51 -04:00
parent 217ce94e1c
commit 21584f4edf
3 changed files with 7 additions and 6 deletions

View file

@ -47,7 +47,7 @@ impl DashboardViewState {
}
pub fn from_unified_data(data: UnifiedData) -> Self {
let mut groups = Vec::new();
let mut groups = Vec::with_capacity(data.groups.len());
for group in data.groups {
groups.push(GroupViewState {
@ -92,7 +92,7 @@ fn get_status_history(heartbeats: &[HeartbeatEntry]) -> Vec<MonitorStatus> {
}
fn add_monitor_view_state(group: UnifiedGroupData) -> Vec<MonitorViewState> {
let mut monitors = Vec::new();
let mut monitors = Vec::with_capacity(group.monitors.len());
for monitor in group.monitors {
let status_history = get_status_history(&monitor.heartbeats);