Allocating with capacity
This commit is contained in:
parent
217ce94e1c
commit
21584f4edf
3 changed files with 7 additions and 6 deletions
|
|
@ -7,7 +7,7 @@ use crate::data::{
|
|||
};
|
||||
|
||||
pub fn unify_data(status_page: &StatusPageResponse, heartbeat: &HeartbeatResponse) -> UnifiedData {
|
||||
let mut groups = Vec::new();
|
||||
let mut groups = Vec::with_capacity(status_page.public_group_list.len());
|
||||
let heartbeat_map: HashMap<u64, Vec<HeartbeatEntry>> = heartbeat
|
||||
.monitors
|
||||
.iter()
|
||||
|
|
@ -21,7 +21,7 @@ pub fn unify_data(status_page: &StatusPageResponse, heartbeat: &HeartbeatRespons
|
|||
.collect();
|
||||
|
||||
for group in &status_page.public_group_list {
|
||||
let mut monitors = Vec::new();
|
||||
let mut monitors = Vec::with_capacity(group.monitor_list.len());
|
||||
for monitor_info in &group.monitor_list {
|
||||
let uptime_data = uptime_map.get(&(monitor_info.id, 24)).cloned();
|
||||
let heartbeats = heartbeat_map
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue