Skip to content

syntax: convert ast_map to use a SmallIntMap. #11616

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 19, 2014
Merged

Conversation

huonw
Copy link
Member

@huonw huonw commented Jan 17, 2014

NodeIds are sequential integers starting at zero, so we can achieve some
memory savings by just storing the items all in a line in a vector.

The occupancy for typical crates seems to be 75-80%, so we're already
more efficient than a HashMap (maximum occupancy 75%), not even counting
the extra book-keeping that HashMap does.

@huonw
Copy link
Member Author

huonw commented Jan 17, 2014

This seems to reduce memory use by about 1-2% for libstd etc (compiling without optimisations; it doesn't appear to make a difference for librustc).

@cmr do you have the bench-individual-PRs code still set up?

@emberian
Copy link
Member

Yes but it's going to be a few more hours until I can get to it.

On Fri, Jan 17, 2014 at 8:22 AM, Huon Wilson notifications@github.comwrote:

This seems to reduce memory use by about 1-2% for libstd etc (compiling
without optimisations; it doesn't appear to make a difference for librustc).

@cmr https://github.com/cmr do you have the bench-individual-PRs code
still set up?


Reply to this email directly or view it on GitHubhttps://github.com//pull/11616#issuecomment-32604986
.

(cx.fold_crate(c), cx.map)
let crate = cx.fold_crate(c);

if log_enabled!(4) { // debug
Copy link
Member

Choose a reason for hiding this comment

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

This could use std::logging::DEBUG instead of hardcoding 4

@alexcrichton
Copy link
Member

Nice find!

bors added a commit that referenced this pull request Jan 18, 2014
NodeIds are sequential integers starting at zero, so we can achieve some
memory savings by just storing the items all in a line in a vector.

The occupancy for typical crates seems to be 75-80%, so we're already
more efficient than a HashMap (maximum occupancy 75%), not even counting
the extra book-keeping that HashMap does.
NodeIds are sequential integers starting at zero, so we can achieve some
memory savings by just storing the items all in a line in a vector.

The occupancy for typical crates seems to be 75-80%, so we're already
more efficient than a HashMap (maximum occupancy 75%), not even counting
the extra book-keeping that HashMap does.
bors added a commit that referenced this pull request Jan 19, 2014
NodeIds are sequential integers starting at zero, so we can achieve some
memory savings by just storing the items all in a line in a vector.

The occupancy for typical crates seems to be 75-80%, so we're already
more efficient than a HashMap (maximum occupancy 75%), not even counting
the extra book-keeping that HashMap does.
@bors bors closed this Jan 19, 2014
@bors bors merged commit 68517a2 into rust-lang:master Jan 19, 2014
@huonw huonw deleted the ast_map branch June 27, 2014 06:48
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 1, 2023
[`needless_return_with_question_mark`]: don't lint if never type is used for coercion

Fixes rust-lang#11616

When we have something like
```rs
let _x: String = {
  return Err(())?;
};
```
we shouldn't suggest removing the `return` because the `!`-ness of `return` is used to coerce the enclosing block to some other type. That will lead to a typeck error without a diverging expression like `return`.

changelog: [`needless_return_with_question_mark`]: don't lint if `return`s never typed-ness is used for coercion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants