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

env_logger performance, eliminating overhead of unused logging calls #112

Closed
Boscop opened this Issue May 13, 2017 · 3 comments

Comments

Projects
None yet
4 participants
@Boscop
Copy link

Boscop commented May 13, 2017

Quoted from here: google/tarpc#139

an interesting observation: we get ~10-20% higher throughput by removing all the debug logging calls in tarpc
things like trace! compiles to a memory load and a branch in the final code, which actually ends up mattering for common calls
I know slog (https://github.com/slog-rs/slog) has unused logging calls be completely compiled away
and also compose a bit more nicely

tarpc uses env_logger. Is is possible to keep the semantics of env_logger the same while optimizing the log calls so that unused logging calls are also completely optimized away?

@dpc

This comment has been minimized.

Copy link

dpc commented May 13, 2017

AFAIK log has exactly same logging statement mechanism, it's just using different defaults (I'm the author of slog and I just mimicked the whole mechanism of log altogether). While slog defaults to info for release and debug for debug builds, log defaults to trace everywhere. You can just change it manually using crate features defined here: https://github.com/rust-lang-nursery/log/blob/master/Cargo.toml#L20

@sfackler

This comment has been minimized.

Copy link
Member

sfackler commented May 13, 2017

Yep, this is exactly why those Cargo features exist.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented May 15, 2017

Sounds like this is all possible! In that case closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.