Skip to content
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 by Bors] - No string in slog #2017

Closed

Conversation

divagant-martian
Copy link
Collaborator

Issue Addressed

Following slog's documentation, this should help a bit with string allocations. I left it run for two days and mem usage is lower. This is of course anecdotal, but shouldn't harm anyway

Proposed Changes

remove String creation in logs when possible

@divagant-martian
Copy link
Collaborator Author

btw, just to be sure before the repetitive task of find replace, the assembly of

fn main() {
    let x = "x";
    println!("{}", x);
}

is 100 lines long,
The one for

fn main() {
    let x = "x";
    println!("{}", &x.to_string());
}

is 150 lines long.

So I assume this is an optimization the compiler / llvm does not do, so it's worth the "extra" effort of using % and ?

Copy link
Member

@AgeManning AgeManning left a comment

Choose a reason for hiding this comment

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

Looks good

@AgeManning
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Nov 30, 2020
## Issue Addressed

Following slog's documentation, this should help a bit with string allocations. I left it run for two days and mem usage is lower. This is of course anecdotal, but shouldn't harm anyway 

## Proposed Changes

remove `String` creation in logs when possible
@divagant-martian
Copy link
Collaborator Author

divagant-martian commented Nov 30, 2020

bors retry? this doesn't seem related

@bors
Copy link

bors bot commented Nov 30, 2020

🔒 Permission denied

Existing reviewers: click here to make divagant-martian a reviewer

@bors bors bot changed the title No string in slog [Merged by Bors] - No string in slog Nov 30, 2020
@bors bors bot closed this Nov 30, 2020
@divagant-martian divagant-martian deleted the no-string-in-slog branch January 4, 2021 08:32
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.

None yet

2 participants