diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-12-23 19:20:50 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-12-23 21:10:23 +0100 |
commit | 6f1b19fee7dc185e13fca0369d1371923e1390b1 (patch) | |
tree | cb326aa8749c1455cdb761d788270758dbfb62f3 /src/codegen/mod.rs | |
parent | 2da6f06a711506a203078fb0be8f5b58fe15d73b (diff) |
Switch to FxHash for hash maps and such.
This isn't such a massive win as I'd have hoped, but it is consistently faster,
so there's no reason not to.
> ./bindgen-old tests/stylo.hpp --no-rustfmt-bindings > /dev/null 2>&1
6.17s user 0.84s system 98% cpu 7.079 total
> ./target/release/bindgen tests/stylo.hpp --no-rustfmt-bindings > /dev/null 2>
5.92s user 0.87s system 98% cpu 6.866 total
Which isn't _that_ much but it's quite a bit.
Diffstat (limited to 'src/codegen/mod.rs')
-rw-r--r-- | src/codegen/mod.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index 9a7bf897..edaf7afe 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -43,12 +43,13 @@ use proc_macro2::{self, Ident, Span}; use std; use std::borrow::Cow; use std::cell::Cell; -use std::collections::{HashSet, VecDeque}; -use std::collections::hash_map::{Entry, HashMap}; +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}; // Name of type defined in constified enum module pub static CONSTIFIED_ENUM_MODULE_REPR_NAME: &'static str = "Type"; @@ -2638,7 +2639,7 @@ impl CodeGenerator for Enum { ); // A map where we keep a value -> variant relation. - let mut seen_values = HashMap::<_, Ident>::new(); + let mut seen_values = HashMap::<_, Ident>::default(); let enum_rust_ty = item.to_rust_ty_or_opaque(ctx, &()); let is_toplevel = item.is_toplevel(ctx); |