Use smartstring to store the external id in our hashmap

We need to store all the external id (primary key) in a hashmap
associated to their internal id during.
The smartstring remove heap allocation / memory usage and should
improve the cache locality.
This commit is contained in:
Tamo
2022-04-11 15:43:18 +02:00
committed by Irevoire
parent 456887a54a
commit ee64f4a936
3 changed files with 10 additions and 7 deletions

View File

@ -1109,8 +1109,11 @@ mod tests {
let mut big_object = HashMap::new();
big_object.insert(S("id"), "wow");
let content: String =
(0..=u16::MAX).into_iter().map(|p| p.to_string()).reduce(|a, b| a + " " + &b).unwrap();
let content: String = (0..=u16::MAX)
.into_iter()
.map(|p| p.to_string())
.reduce(|a, b| a + " " + b.as_ref())
.unwrap();
big_object.insert("content".to_string(), &content);
let mut cursor = Cursor::new(Vec::new());