[ 
https://issues.apache.org/jira/browse/HTTPCORE-361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16705797#comment-16705797
 ] 

ASF subversion and git services commented on HTTPCORE-361:
----------------------------------------------------------

Commit b76b34e3c561193c5222e83442ab48a2f517f693 in httpcomponents-core's branch 
refs/heads/master from [~olegk]
[ https://git-wip-us.apache.org/repos/asf?p=httpcomponents-core.git;h=b76b34e ]

Removed obsolete references to HTTPCORE-361 ticket


> Please reduce object creation in HeaderGroup.getFirstHeader()
> -------------------------------------------------------------
>
>                 Key: HTTPCORE-361
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-361
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 4.3
>            Reporter: Sebastiano Vigna
>            Priority: Minor
>             Fix For: 4.3.1
>
>
>  The current implementation of getFirstHeader()
>     public Header getFirstHeader(final String name) {
>         for (final Header header : headers) {
>             if (header.getName().equalsIgnoreCase(name)) {
>                 return header;
>             }
>         }
>         return null;
>     }
> uses a Java syntax that creates an iterator object for eac hcall. We are 
> seeing a lot of those in heap dumps. The getLastHeader() method uses a loop 
> and has no such problems.
> We realize that it is slightly less elegant, but it would be great if you 
> could change this method into
>     public Header getFirstHeader(final String name) {
>         final int size = headers.size();
>         for (int i = 0; i < size; i++) {
>             final Header header = headers.get(i);
>             if (header.getName().equalsIgnoreCase(name)) {
>                 return header;
>             }
>         }
>         return null;
> }



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to