-
Notifications
You must be signed in to change notification settings - Fork 95
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 performance #19
Comments
Where are benchmarks? |
Maybe |
Hmm... |
I forgot to commit some files. :D Should be there now. |
Of course. I'm not sure about how you obtain those string. In blacklog there was a choice what to save: a raw string literal, which does not require formatting (use &'static str) or a result of Did you think about integration with Rust formatting ecosystem? |
Because there - https://github.com/dpc/slog-rs/blob/master/crates/stdlog/src/lib.rs#L61 - arguments are evaluated every time, even if an event will be filtered out. |
Oh, good catch. I haven't looked into |
Now you have make me thing about it. Simplest solution that I come up with, ATM is This would also allow taking msg that would have formatting in it, if necessary. Though it seems to me, that structured logging avoids need for What do you think? |
I think formatting is important. Actually creating Then you don't need to store msg: &'str in the record, just store args: Arguments<'a> (it's Copy, but tricky, because of borrowing). The Dark side: because log now accepts |
The biggest problem is that |
Just as replacing |
There was so much problem with it... In short version... I actually got it work, but with The way I think about: if anyone really, really needs
I need to benchmark closure values, and see if there's no fundamental problems with their performance. |
Disagree, but as your wish. |
I'm still open to being convinced, if you feel strongly about it, and if more people will voice an opinion in favour of changing it, I probably will. After I got |
Also, it seems to me that current version of closure values is sub-optimal. Eg. sometimes it needs to allocate String etc. since it has to return the value (so it can't return newly created Maybe passing it some handle that would allow it to call a method to serialize a value would help? |
While thinking about #16 I've noticed that switching drains at run-time is not something everyone needs, while it prevents optimizations. Removing it to be a separate drain, was a big benchmark win. |
OK, so |
It's done. |
https://github.com/dpc/slog-rs/wiki/Bench-log
Ideas:
&'a str
in RecordInfo`39e6b5e
Arc
chaining instead of copying in Logger hierarchies?SerializeKey
forFn(&RecordInfo, mut io::Writer)
? so the value can output itself without returning?feature
that standardlog
uses to remove logging statesments at compile time. Now that macros are being used, this should work smoothly.The text was updated successfully, but these errors were encountered: