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

Optimize logging codegen #276

Merged
merged 1 commit into from
Jun 5, 2018
Merged

Optimize logging codegen #276

merged 1 commit into from
Jun 5, 2018

Conversation

sfackler
Copy link
Member

@sfackler sfackler commented Jun 3, 2018

The extra work involved in loading the logger and creating the record
struct involves move codegen than is necessary if we take this kind of
approach (which we previously used in 0.3). It's a bit unfortunate to
have these public-but-not-public functions, but I think it's worth it.
We want to minimize the footprint of logging so people feel comfortable
using it!

A main function containing nothing but warn!("hello world") shrinks
from 204 bytes to 124 bytes in x86_64 with this change.

Closes #275

The extra work involved in loading the logger and creating the record
struct involves move codegen than is necessary if we take this kind of
approach (which we previously used in 0.3). It's a bit unfortunate to
have these public-but-not-public functions, but I think it's worth it.
We want to minimize the footprint of logging so people feel comfortable
using it!

A main function containing nothing but `warn!("hello world")` shrinks
from 204 bytes to 124 bytes in x86_64 with this change.

Closes rust-lang#275
@sfackler
Copy link
Member Author

sfackler commented Jun 3, 2018

r? @KodrAus

Copy link
Contributor

@KodrAus KodrAus left a comment

Choose a reason for hiding this comment

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

This looks good to me! Do you think it's worth leaving a comment on __private_api_log motivating it as reducing generated code size in crates that use log?

@sfackler
Copy link
Member Author

sfackler commented Jun 3, 2018

I generally like to use git-blame for that kind of background, but it also seems fine to add.

@KodrAus
Copy link
Contributor

KodrAus commented Jun 3, 2018

git-blame seems reasonable to me 👍

@sfackler sfackler merged commit b16b5ad into rust-lang:master Jun 5, 2018
@sfackler sfackler deleted the codegen branch June 5, 2018 05:40
EFanZh pushed a commit to EFanZh/log that referenced this pull request Jul 23, 2023
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.

2 participants