-
Notifications
You must be signed in to change notification settings - Fork 26
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
Fmt.styled gets slower over time #52
Comments
Can't dive into this right now but I suspect a problem with the strategy to make styles composable. This was introduced by a series of patch that ends here 594a1d7 |
Also, avoid `Logs_fmt.pp_header` due to dbuenzli/fmt#52
Also, avoid `Logs_fmt.pp_header` due to dbuenzli/fmt#52
Also, avoid `Logs_fmt.pp_header` due to dbuenzli/fmt#52
Just tried to have a quick look at that. First my experience is a little bit different that yours. Performance actually goes up and down [1], likely with gc occurring. The culprit is likely this function. Each Maybe we should switch back to the horrible hack we had before to store arbitrary metadata in the formatter itself by hijacking the tags mecanism. [1]: |
Hmm, it seems to depend on the version of OCaml: 4.12 goes up and down, but 4.13 only goes down! |
That's strange does this uncover a bug ephemerons ? Note that you can mitigate by creating your own formatter. @pqwy suggests reusing the formatter in I'm rather tempted to go back to subvert the tags mecanism, which is uncompositional anyways, than using sophisticated gc mecanisms. |
I was able to work around it by configuring my log reporter to use |
The problem is that the
Well yes |
Just to make things clear your log reporter eventually outputs using |
My reporter uses The use of |
Yes that also allocates one formatter on each call.
Since you can't access the formatter, these functions use the default style renderer which is |
@talex5 It's a bit odd, I tested with 4.13 on macOS 11.6 with First I get an order of magnitude more messages per second (!) and the rate only halves (rather than thirds) before going up again. |
@talex5 I have pushed a solution for the problem. Could you please confirm that solves the problem for you. |
Thanks - that's a lot faster!
|
Thanks the release is on its way. |
I've been investigating a problem with my programs slowing down over time, but only when logging is configured. The problem seems to be with fmt (0.8.10)!
With this test program:
I get:
Replacing
Fmt.(styled `Blue string)
withFmt.string
shows no slow-down.The text was updated successfully, but these errors were encountered: