-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
Use maud templates and serde_json for directory listings #367
Conversation
Review changes with SemanticDiff. Analyzed 1 of 3 files. Overall, the semantic diff is 5% smaller than the GitHub diff.
|
Yes, serde_json can do the job, go for it. |
Separate PR once this is merged then. |
Added change to the JSON-formatted directory listings to this PR after all, would have been a fat merge conflict otherwise. Performance is minimally improved in local tests, around 2%. Originally I used an intermediate data structure for JSON serialization. It made sense to serialize |
This caused an unexpected performance regression for HTML listings, both large and small. This makes little sense, trying to figure out what’s going on there. |
It’s a performance regression that cannot be reproduced locally. And flamegraph only shows that a bulk of the time is taken up by chrono and humansize calls but these didn’t change. |
Of course I cannot reproduce a performance regression locally if it isn’t caused by this change. 🙄 The performance regression first shows up when current development is merged into this branch. Looking into the changes, #360 appears to be the culprit. |
Yeah, It can be due to the dynamic compression. What I noted in the benchmarks is that the regression is notorious when listing large index. E.g. ~48% latency increase compared to for nginx. But in other tests, we are almost closer to the first two servers. |
That’s not because of the compression, has nothing to do with this “regression.” We are simply pretty slow at formatting file sizes and modification times. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Description
This is essentially the same as #365 but using maud templates. Maud provides a cleaner syntax than sailfish (IMHO), and it doesn’t masquerade as being separate from the code (sailfish templates also use variables which are in scope even when these are outside the template). Local testing indicates no performance difference here either. But unlike sailfish, using maud doesn’t result in additional whitespace.
Downside: maud is for HTML only, JSON logic remains as it was. Then again, maybe it’s better to just go to serde_json for a cleaner JSON generation approach.
How Has This Been Tested?
Integration tests pass. Functional testing on Linux is also fine.