From e559f7130c3375d206a9a6579afd997014b0ac93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Sun, 2 Dec 2018 13:11:02 +0100 Subject: [PATCH] feat: Replace the fnv hashmap by the hashbrown one --- Cargo.toml | 2 +- src/rank/distinct_map.rs | 3 ++- src/rank/ranked_stream.rs | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 81f33426c..c92089e28 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ authors = ["Kerollmops "] [dependencies] bincode = "1.0" byteorder = "1.2" -fnv = "1.0" +hashbrown = "0.1" lazy_static = "1.1" linked-hash-map = { version = "0.5", features = ["serde_impl"] } sdset = "0.3" diff --git a/src/rank/distinct_map.rs b/src/rank/distinct_map.rs index 39262e7c5..98a6947ad 100644 --- a/src/rank/distinct_map.rs +++ b/src/rank/distinct_map.rs @@ -1,6 +1,7 @@ -use std::collections::HashMap; use std::hash::Hash; +use hashbrown::HashMap; + pub struct DistinctMap { inner: HashMap, limit: usize, diff --git a/src/rank/ranked_stream.rs b/src/rank/ranked_stream.rs index a2391b98a..df32f9f32 100644 --- a/src/rank/ranked_stream.rs +++ b/src/rank/ranked_stream.rs @@ -3,10 +3,10 @@ use std::{mem, vec, str}; use std::error::Error; use std::hash::Hash; -use fnv::FnvHashMap; -use fst::Streamer; -use group_by::GroupByMut; use ::rocksdb::rocksdb::{DB, Snapshot}; +use group_by::GroupByMut; +use hashbrown::HashMap; +use fst::Streamer; use crate::automaton::{self, DfaExt, AutomatonExt}; use crate::rank::criterion::{self, Criterion}; @@ -77,7 +77,7 @@ where T: Deref, op_builder.union() }; - let mut matches = FnvHashMap::default(); + let mut matches = HashMap::new(); while let Some((input, indexed_values)) = stream.next() { for iv in indexed_values {