Skip to content

Conversation

retep998
Copy link
Contributor

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

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

Signed-off-by: Peter Atashian <[email protected]>
@retep998
Copy link
Contributor 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
Contributor

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
Contributor 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
Contributor 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