-
Notifications
You must be signed in to change notification settings - Fork 214
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
optionally disable verbose logging to improve performance #211
Conversation
Not sure if it's better to disable verbose logging by default, by using |
Hm, interesting. I would imagine that logging may take a decent amount of time in case the trace level logs (quite low level) are enabled and displayed on the screen / redirected to the file. But if I got your point right, even if you just normally use the library without getting any trace logs, you still observe the picture above with the distribution of time |
I got the above flamegraph when disabling trace logging in tungstenite. I think part of the problem is the filtering in |
So after you applied the changes suggested in the PR you got the posted flamegraph, right?
Ok, so what I meant with my comment is that normally I.e. I expect that if you don't have any logging enabled in your crate, no tungstenite's logs will appear and the performance burden will not be huge. I might be wrong though. But if I am wrong, then I think the solution should be using the compile time filter for |
By "removing all loggings" you mean applying the changes in this PR, right? (just so that we're on the same page)
Makes sense, but what about this: we do introduce a new feature flag for disabling trace logging, however instead of adding the conditional to enable/disable certain parts of the code depending on the feature, we just use the above mentioned strategy (passing a feature flags to the |
Yes
It does not work. features are enabled globally. I.e. Maybe we can do this: #[cfg(feature = "verbose-log")]
macro_rules! tung_trace {
($($arg:expr),*) => { log::trace!($($arg),*); };
}
#[cfg(not(feature = "verbose-log"))]
macro_rules! tung_trace {
($level:ident, $($arg:expr),*) => {{ $( let _ = $arg; )* }}
} |
Another possibility that I thought about is to remove the @jxs, what do you think? |
There was no response from @jxs, so if no-one objects, then I think the best way would be just removing traces there. I don't remember us using it after the first production-ready version. Seems like they are not much of a use. It does not seem like introducing a whole feature for that is worth it 🙂 |
119b246
to
37acfb3
Compare
There have been no updates on this for almost half a year, so we decided to close it. Feel free to re-open in case any changes are desired :) |
Currently the logging is too verbose. As seen from the flamegraph, half of the time is spent on logging. This PR adds a feature
no-verbose-logging
that disables these annoying loggings.