hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <j...@apache.org>
Subject [jira] [Moved] (HTTPCORE-361) Please reduce object creation in HeaderGroup.getFirstHeader()
Date Mon, 04 Nov 2013 13:32:20 GMT

     [ https://issues.apache.org/jira/browse/HTTPCORE-361?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Oleg Kalnichevski moved HTTPCLIENT-1430 to HTTPCORE-361:
--------------------------------------------------------

          Component/s:     (was: HttpClient)
                       HttpCore
    Affects Version/s:     (was: 4.3.1)
                       4.3
             Workflow: classic default workflow  (was: Default workflow, editable Closed status)
                  Key: HTTPCORE-361  (was: HTTPCLIENT-1430)
              Project: HttpComponents HttpCore  (was: HttpComponents HttpClient)

> 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
>
> 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
(v6.1#6144)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message