Skip to content

Commit

Permalink
rustc: Switch ty::node_type_table to smallintmap, cut 400mb memory us…
Browse files Browse the repository at this point in the history
…e off a librustc build.

Smallintmap was being populated with sparse keys during ast deserialization.
  • Loading branch information
graydon committed May 28, 2013
1 parent 2061ce9 commit 3c4ce79
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/librustc/middle/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ type type_cache = @mut HashMap<ast::def_id, ty_param_bounds_and_ty>;

type constness_cache = @mut HashMap<ast::def_id, const_eval::constness>;

pub type node_type_table = @mut SmallIntMap<t>;
pub type node_type_table = @mut HashMap<uint,t>;

fn mk_rcache() -> creader_cache {
return @mut HashMap::new();
Expand All @@ -934,7 +934,7 @@ pub fn mk_ctxt(s: session::Session,
def_map: dm,
region_maps: region_maps,
region_paramd_items: region_paramd_items,
node_types: @mut SmallIntMap::new(),
node_types: @mut HashMap::new(),
node_type_substs: @mut HashMap::new(),
trait_refs: @mut HashMap::new(),
trait_defs: @mut HashMap::new(),
Expand Down

2 comments on commit 3c4ce79

@thestinger
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+

@graydon
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p=100

Please sign in to comment.