Skip to content
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

Performance: reserve body to avoid frequent reallocations and copies #1782

Closed
wants to merge 2 commits into from

Conversation

ArnaudBienner
Copy link
Contributor

This is an alternative approach to #1781.

It is simpler: only one line, the checks on length have already been made.

But I wasn't sure if it was OK or not, since this implies x has a body member, so it makes this template function less generic, which might defeat the purpose of having a template here...

httplib.h Outdated Show resolved Hide resolved
@yhirose
Copy link
Owner

yhirose commented Feb 23, 2024

@ArnaudBienner thanks for the pull request. The fuzzing test failed. I re-run two more times, but it always fails. Could you take a look at the log?

@ArnaudBienner
Copy link
Contributor Author

@yhirose I'll have a look. I suspect this is due to the max limit being too high resulting in memory allocation failures.

Apart from that, do you think this is the good way to improve the performance I had, or is #1781 is better? If you think the other PR is preferable, I can simply close this PR without further investigation.

@yhirose
Copy link
Owner

yhirose commented Feb 24, 2024

Yes, you can just close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants