Skip to content

Commit

Permalink
Changed default Hash{Map|Set} capacity
Browse files Browse the repository at this point in the history
  • Loading branch information
myui committed Nov 18, 2024
1 parent cb81476 commit 15ebd58
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/ftrl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ impl FTRL {
beta,
lambda1,
lambda2,
z: HashMap::new(),
n: HashMap::new(),
weights: HashMap::new(),
z: HashMap::with_capacity(8192),
n: HashMap::with_capacity(8192),
weights: HashMap::with_capacity(8192),
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/identifiers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ impl Identifier {
Self {
name: name.to_string(),
pass_through: None,
obj_to_id: HashMap::new(),
id_to_obj: Vec::new(),
obj_to_id: HashMap::with_capacity(8192),
id_to_obj: Vec::with_capacity(8192),
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/interactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ impl UserItemInteractions {
let decay_rate = decay_in_days.map(|days| 1.0 - (E.ln() / days));

UserItemInteractions {
interactions: HashMap::new(),
all_item_ids: HashSet::new(),
interactions: HashMap::with_capacity(8192),
all_item_ids: HashSet::with_capacity(8192),
min_value,
max_value,
decay_rate,
Expand Down

0 comments on commit 15ebd58

Please sign in to comment.