-
Notifications
You must be signed in to change notification settings - Fork 131
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
Slowness #123
Comments
Does adding a filter to exclude logs from As far as I know, |
So I looked at |
Not sure what exactly happened there: might have been something to do with optimalization causing this to point to slightly different function, but I don't think it's very relevant. I've hit this issue before, and it looks it's caused by I was using a very simple In https://github.com/sebasmagri/env_logger/blob/master/src/filter/mod.rs#L164 as soon as the target is enabled, every logging statement will be run against a regex, and there's a Now I've noticed that I can actually disable Maybe there's more of clever things that can be tried there to optimize the performance, or something is wrong somewhere. |
Ah right, that code hasn't been touched in a couple of years so there's probably plenty of opportunity to optimise it. We can work on building up a decent set of benchmarks to track changes in performance. |
If somebody would like to work on |
I profiled my (rather large) backend server and to my surprise found that the time spent logging is orders of magnitude more than the actual program. I saw that What would be your advice on this issue? Would switching to |
@PvdBerg1998 |
Yeh, on the printing side |
Is there anything we can/want to do on our side? Not sure if something like offloading the work is in-scope of the crate to be honest. I'm happy about speed improvements however, and I'll probably also take a closer look at the matching algorithm |
IMO. I think my main problem was here was that each logging statement has to go through a regex (if regex feature is enabled). Maybe some tiny cache could provide a substantial speedup. Or maybe there's something else that can be done to avoid it. |
It would be nice to pull the filters out into a separate library, since they are pretty useful on their own, and for other loggers. |
As soon as you enable
RUST_LOG
, even for just a small module that logs infrequently, the performance of your program is going to go drastically downhill.Example: https://i.imgur.com/al4BJUn.png
As you can see, just because
serde_json::read::Read
has sometrace!
inparse_str
somewhere, is completely destroying my program, for which I've enabled debugging just for my main module.Is there anything that can be done about it?
The text was updated successfully, but these errors were encountered: