Skip to content

Improve memory usage of libsyntax #17223

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
Sep 17, 2014
Merged

Conversation

retep998
Copy link
Member

Replaces some usage of .to_string() with .into_string()

Replaces some usage of `.to_string()` with `.into_string()`

Signed-off-by: Peter Atashian <retep998@gmail.com>
@retep998
Copy link
Member Author

Graph of memory usage comparison while building librustc:

@@ -121,7 +121,7 @@ impl fmt::Show for RcStr {
impl RcStr {
pub fn new(string: &str) -> RcStr {
RcStr {
string: Rc::new(string.to_string()),
string: Rc::new(string.into_string()),
Copy link
Member

Choose a reason for hiding this comment

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

(FWIW, I guess is the change that is making the noticable difference; everything else seems minor.)

@retep998
Copy link
Member Author

Another solution to this issue would be #16544 but since to_string has to go through a complicated Show invocation, simply using into_string is probably better.

@tshepang
Copy link
Member

@retep998 what did you use to generate that graph?

@retep998
Copy link
Member Author

@tshepang A program I wrote using WinAPI to record the memory usage of rustc, and then Excel to turn the data into a graph.

bors added a commit that referenced this pull request Sep 17, 2014
Replaces some usage of `.to_string()` with `.into_string()`
@bors bors closed this Sep 17, 2014
@bors bors merged commit bcad3a5 into rust-lang:master Sep 17, 2014
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.

5 participants