Skip to content

Commit

Permalink
use an FnvHashSet instead of an HashSet in fulfill
Browse files Browse the repository at this point in the history
this doesn't cause a measurable perf increase, but it makes callgrind output
cleaner. Anyway, rustc should be using FNV everywhere.
  • Loading branch information
Ariel Ben-Yehuda committed Aug 17, 2015
1 parent 9b75a2b commit 96e6b2f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/librustc/middle/traits/fulfill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ use middle::infer::InferCtxt;
use middle::ty::{self, RegionEscape, Ty, HasTypeFlags};
use middle::wf;

use std::collections::HashSet;
use std::fmt;
use syntax::ast;
use util::common::ErrorReported;
use util::nodemap::NodeMap;
use util::nodemap::{FnvHashSet, NodeMap};

use super::CodeAmbiguity;
use super::CodeProjectionError;
Expand All @@ -33,7 +32,7 @@ use super::Unimplemented;
use super::util::predicate_for_builtin_bound;

pub struct FulfilledPredicates<'tcx> {
set: HashSet<(RFC1214Warning, ty::Predicate<'tcx>)>
set: FnvHashSet<(RFC1214Warning, ty::Predicate<'tcx>)>
}

/// The fulfillment context is used to drive trait resolution. It
Expand Down Expand Up @@ -540,7 +539,7 @@ fn register_region_obligation<'tcx>(t_a: Ty<'tcx>,
impl<'tcx> FulfilledPredicates<'tcx> {
pub fn new() -> FulfilledPredicates<'tcx> {
FulfilledPredicates {
set: HashSet::new()
set: FnvHashSet()
}
}

Expand Down

0 comments on commit 96e6b2f

Please sign in to comment.