You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (JIRA)" <ji...@apache.org> on 2019/02/12 09:26:00 UTC
[jira] [Resolved] (HTTPCORE-518) Improve buffer allocation
[ https://issues.apache.org/jira/browse/HTTPCORE-518?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oleg Kalnichevski resolved HTTPCORE-518.
----------------------------------------
Resolution: Won't Fix
> Improve buffer allocation
> -------------------------
>
> Key: HTTPCORE-518
> URL: https://issues.apache.org/jira/browse/HTTPCORE-518
> Project: HttpComponents HttpCore
> Issue Type: Improvement
> Components: HttpCore NIO
> Reporter: Ion Moldovan
> Priority: Minor
>
> The doubling of the buffer size every time it exceeds its previous size is a good way for small buffers, but quite wasteful for large sizes.
> A more modest growth (e.g. 1.25 x Previous Size) when sizes are > 32MB would be a nice improvement.
> Proposed solution:
> {code:java}
> /**
> * Expands buffer's capacity.
> *
> * @throws BufferOverflowException in case we get over the maximum allowed value
> */
> protected void expand() throws BufferOverflowException {
> int newcapacity;
> if (this.buffer.capacity() <= (32 << 20) ) {
> newcapacity = (this.buffer.capacity() + 1) << 1;
> } else {
> newcapacity = (this.buffer.capacity() + 1) * 5 / 4;
> }
> ...
> }
> {code}
> What do you think?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org