-
Notifications
You must be signed in to change notification settings - Fork 423
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
Poor performance of ContentType header rendering #2573
Comments
/bounty $150 |
|
/attempt #2573 Options |
💡 @kyri-petrou submitted a pull request that claims the bounty. You can visit your bounty board to reward. |
🎉🎈 @kyri-petrou has been awarded $150! 🎈🎊 |
Describe the bug
Hi there 👋. I was going through some profiling data of a web-app and there was a disproportionally high % of CPU being spent on the
zio.http.Header$ContentType.renderedValueAsCharSequence()
method (up to 5% of the application's total CPU time)To Reproduce
Using JMH:
Results:
Expected behaviour
I understand there is some additional logic needed in rendering the content type fully (charset, boundaries), but I would expect
header.renderedValue
's performance to be somewhat similar to using string interpolationAdditional context
A workaround to the issue is to use
.untyped
on the header, as that forces the rendered value to be cached. However, that does not work in cases where the content type header is dynamically createdThe text was updated successfully, but these errors were encountered: