Skip to content

Optimize logging codegen#276

Merged
sfackler merged 1 commit into
rust-lang:masterfrom
sfackler:codegen
Jun 5, 2018
Merged

Optimize logging codegen#276
sfackler merged 1 commit into
rust-lang:masterfrom
sfackler:codegen

Conversation

@sfackler
Copy link
Copy Markdown
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
Copy Markdown
Member Author

sfackler commented Jun 3, 2018

r? @KodrAus

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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