summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2018-12-23 19:32:25 +0100
committerEmilio Cobos Álvarez <emilio@crisal.io>2018-12-23 21:10:23 +0100
commit8a579b134dbaf369803cffbe835ba14ab2765fba (patch)
tree701a9e04ae0350645ecf17568b942cc26a255a2e
parent6f1b19fee7dc185e13fca0369d1371923e1390b1 (diff)
Switch to hashbrown.
This wins between 2 and 5 milliseconds more in the test-case above, so no reason not to I guess.
-rw-r--r--Cargo.lock25
-rw-r--r--Cargo.toml2
-rw-r--r--src/codegen/mod.rs3
-rw-r--r--src/lib.rs8
4 files changed, 22 insertions, 16 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 6295be57..ce167ca2 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -56,7 +56,7 @@ dependencies = [
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "hashbrown 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -145,17 +145,18 @@ dependencies = [
]
[[package]]
-name = "fxhash"
-version = "0.2.1"
+name = "glob"
+version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
-]
[[package]]
-name = "glob"
-version = "0.2.11"
+name = "hashbrown"
+version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
+]
[[package]]
name = "humantime"
@@ -278,6 +279,11 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "scopeguard"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
name = "shlex"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -412,8 +418,8 @@ dependencies = [
"checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a"
"checksum env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afb070faf94c85d17d50ca44f6ad076bce18ae92f0037d350947240a36e9d42e"
"checksum failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6dd377bcc1b1b7ce911967e3ec24fa19c3224394ec05b54aa7b083d498341ac7"
-"checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
+"checksum hashbrown 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "64b7d419d0622ae02fe5da6b9a5e1964b610a65bb37923b976aeebb6dbb8f86e"
"checksum humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e"
"checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7"
"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d"
@@ -430,6 +436,7 @@ dependencies = [
"checksum regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2069749032ea3ec200ca51e4a31df41759190a88edca0d2d86ee8bedf7073341"
"checksum regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "747ba3b235651f6e2f67dfa8bcdcd073ddb7c243cb21c442fc12395dfcac212d"
"checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395"
+"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
"checksum shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
"checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f"
diff --git a/Cargo.toml b/Cargo.toml
index 2cb96ac1..e1d9dcba 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -54,7 +54,7 @@ peeking_take_while = "0.1.2"
quote = { version = "0.6", default-features = false }
regex = "1.0"
which = "2.0"
-fxhash = "0.2"
+hashbrown = "0.1"
# New validation in 0.3.6 breaks bindgen-integration:
# https://github.com/alexcrichton/proc-macro2/commit/489c642.
proc-macro2 = { version = "0.4", default-features = false }
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index edaf7afe..9c818cc1 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -44,12 +44,11 @@ use std;
use std::borrow::Cow;
use std::cell::Cell;
use std::collections::VecDeque;
-use std::collections::hash_map::Entry;
use std::fmt::Write;
use std::iter;
use std::ops;
use std::str::FromStr;
-use {HashMap, HashSet};
+use {HashMap, HashSet, Entry};
// Name of type defined in constified enum module
pub static CONSTIFIED_ENUM_MODULE_REPR_NAME: &'static str = "Type";
diff --git a/src/lib.rs b/src/lib.rs
index ef15d49a..e11773ef 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -23,7 +23,7 @@ extern crate cexpr;
#[allow(unused_extern_crates)]
extern crate cfg_if;
extern crate clang_sys;
-extern crate fxhash;
+extern crate hashbrown;
#[macro_use]
extern crate lazy_static;
extern crate peeking_take_while;
@@ -97,9 +97,9 @@ use std::process::{Command, Stdio};
use std::sync::Arc;
// Some convenient typedefs for a fast hash map and hash set.
-type HashMap<K, V> = ::fxhash::FxHashMap<K, V>;
-type HashSet<K> = ::fxhash::FxHashSet<K>;
-pub(crate) use ::std::collections::hash_map::Entry;
+type HashMap<K, V> = ::hashbrown::HashMap<K, V>;
+type HashSet<K> = ::hashbrown::HashSet<K>;
+pub(crate) use ::hashbrown::hash_map::Entry;
fn args_are_cpp(clang_args: &[String]) -> bool {
return clang_args