Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 00e48af

Browse files
committedNov 8, 2016
Replace FnvHasher use with FxHasher.
This speeds up compilation by 3--6% across most of rustc-benchmarks.
1 parent eca1cc9 commit 00e48af

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+588
-588
lines changed
 

‎src/librustc/infer/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use std::fmt;
3939
use syntax::ast;
4040
use errors::DiagnosticBuilder;
4141
use syntax_pos::{self, Span, DUMMY_SP};
42-
use util::nodemap::{FnvHashMap, FnvHashSet, NodeMap};
42+
use util::nodemap::{FxHashMap, FxHashSet, NodeMap};
4343

4444
use self::combine::CombineFields;
4545
use self::higher_ranked::HrMatchResult;
@@ -134,7 +134,7 @@ pub struct InferCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
134134

135135
// the set of predicates on which errors have been reported, to
136136
// avoid reporting the same error twice.
137-
pub reported_trait_errors: RefCell<FnvHashSet<traits::TraitErrorKey<'tcx>>>,
137+
pub reported_trait_errors: RefCell<FxHashSet<traits::TraitErrorKey<'tcx>>>,
138138

139139
// Sadly, the behavior of projection varies a bit depending on the
140140
// stage of compilation. The specifics are given in the
@@ -170,7 +170,7 @@ pub struct InferCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
170170

171171
/// A map returned by `skolemize_late_bound_regions()` indicating the skolemized
172172
/// region that each late-bound region was replaced with.
173-
pub type SkolemizationMap<'tcx> = FnvHashMap<ty::BoundRegion, &'tcx ty::Region>;
173+
pub type SkolemizationMap<'tcx> = FxHashMap<ty::BoundRegion, &'tcx ty::Region>;
174174

175175
/// Why did we require that the two types be related?
176176
///
@@ -492,7 +492,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'gcx> {
492492
selection_cache: traits::SelectionCache::new(),
493493
evaluation_cache: traits::EvaluationCache::new(),
494494
projection_cache: RefCell::new(traits::ProjectionCache::new()),
495-
reported_trait_errors: RefCell::new(FnvHashSet()),
495+
reported_trait_errors: RefCell::new(FxHashSet()),
496496
projection_mode: Reveal::NotSpecializable,
497497
tainted_by_errors_flag: Cell::new(false),
498498
err_count_on_creation: self.sess.err_count(),
@@ -531,7 +531,7 @@ impl<'a, 'gcx, 'tcx> InferCtxtBuilder<'a, 'gcx, 'tcx> {
531531
parameter_environment: param_env,
532532
selection_cache: traits::SelectionCache::new(),
533533
evaluation_cache: traits::EvaluationCache::new(),
534-
reported_trait_errors: RefCell::new(FnvHashSet()),
534+
reported_trait_errors: RefCell::new(FxHashSet()),
535535
projection_mode: projection_mode,
536536
tainted_by_errors_flag: Cell::new(false),
537537
err_count_on_creation: tcx.sess.err_count(),
@@ -1530,7 +1530,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
15301530
span: Span,
15311531
lbrct: LateBoundRegionConversionTime,
15321532
value: &ty::Binder<T>)
1533-
-> (T, FnvHashMap<ty::BoundRegion, &'tcx ty::Region>)
1533+
-> (T, FxHashMap<ty::BoundRegion, &'tcx ty::Region>)
15341534
where T : TypeFoldable<'tcx>
15351535
{
15361536
self.tcx.replace_late_bound_regions(

‎src/librustc/infer/region_inference/graphviz.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use middle::region::CodeExtent;
2323
use super::Constraint;
2424
use infer::SubregionOrigin;
2525
use infer::region_inference::RegionVarBindings;
26-
use util::nodemap::{FnvHashMap, FnvHashSet};
26+
use util::nodemap::{FxHashMap, FxHashSet};
2727

2828
use std::borrow::Cow;
2929
use std::collections::hash_map::Entry::Vacant;
@@ -122,8 +122,8 @@ pub fn maybe_print_constraints_for<'a, 'gcx, 'tcx>(
122122
struct ConstraintGraph<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
123123
tcx: TyCtxt<'a, 'gcx, 'tcx>,
124124
graph_name: String,
125-
map: &'a FnvHashMap<Constraint<'tcx>, SubregionOrigin<'tcx>>,
126-
node_ids: FnvHashMap<Node, usize>,
125+
map: &'a FxHashMap<Constraint<'tcx>, SubregionOrigin<'tcx>>,
126+
node_ids: FxHashMap<Node, usize>,
127127
}
128128

129129
#[derive(Clone, Hash, PartialEq, Eq, Debug, Copy)]
@@ -145,7 +145,7 @@ impl<'a, 'gcx, 'tcx> ConstraintGraph<'a, 'gcx, 'tcx> {
145145
map: &'a ConstraintMap<'tcx>)
146146
-> ConstraintGraph<'a, 'gcx, 'tcx> {
147147
let mut i = 0;
148-
let mut node_ids = FnvHashMap();
148+
let mut node_ids = FxHashMap();
149149
{
150150
let mut add_node = |node| {
151151
if let Vacant(e) = node_ids.entry(node) {
@@ -235,7 +235,7 @@ impl<'a, 'gcx, 'tcx> dot::GraphWalk<'a> for ConstraintGraph<'a, 'gcx, 'tcx> {
235235
type Node = Node;
236236
type Edge = Edge<'tcx>;
237237
fn nodes(&self) -> dot::Nodes<Node> {
238-
let mut set = FnvHashSet();
238+
let mut set = FxHashSet();
239239
for node in self.node_ids.keys() {
240240
set.insert(*node);
241241
}
@@ -261,7 +261,7 @@ impl<'a, 'gcx, 'tcx> dot::GraphWalk<'a> for ConstraintGraph<'a, 'gcx, 'tcx> {
261261
}
262262
}
263263

264-
pub type ConstraintMap<'tcx> = FnvHashMap<Constraint<'tcx>, SubregionOrigin<'tcx>>;
264+
pub type ConstraintMap<'tcx> = FxHashMap<Constraint<'tcx>, SubregionOrigin<'tcx>>;
265265

266266
fn dump_region_constraints_to<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
267267
map: &ConstraintMap<'tcx>,
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.