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

Form output buffers a lot #81

Open
mbenson opened this issue Dec 20, 2019 · 0 comments
Open

Form output buffers a lot #81

mbenson opened this issue Dec 20, 2019 · 0 comments

Comments

@mbenson
Copy link

mbenson commented Dec 20, 2019

Buffer expansions in Output's ByteArrayOutputStream duplicate content, and then that array is duplicated again with #toByteArray(). I have been working on a PR to try to use a single array, but would want to refactor Request.Body in the core project to use a wrapper (probably java.nio.ByteBuffer). This would allow to use a buffer that might be longer than the actual content, on the thinking that it's more efficient to use CharsetEncoder#maxBytesPerChar() than to actually encode a given String twice, and that an array slightly longer than needed is still better than two arrays of the proper length. It should be possible to maintain backward compatibility of the API, but since this would require coordination across repositories I thought best to open a PR to begin with.

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

No branches or pull requests

1 participant