You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Carsten Ziegeler (JIRA)" <ji...@apache.org> on 2016/08/05 08:33:20 UTC

[jira] [Closed] (FELIX-5287) [SSLFilter] use Integer.parseInt instead of Integer.valueOf

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

Carsten Ziegeler closed FELIX-5287.
-----------------------------------

> [SSLFilter] use Integer.parseInt instead of Integer.valueOf
> -----------------------------------------------------------
>
>                 Key: FELIX-5287
>                 URL: https://issues.apache.org/jira/browse/FELIX-5287
>             Project: Felix
>          Issue Type: Improvement
>          Components: HTTP Service
>    Affects Versions: http.sslfilter-1.0.6
>            Reporter: Jörg Hoh
>            Assignee: Carsten Ziegeler
>            Priority: Minor
>             Fix For: http.sslfilter-1.0.8
>
>
> SslFilterRequest.getPort() uses Integer.valueOf to extract the port from the header, but just returns the primitive type. Thus it relies on the auto-unboxing, which takes a bit of time.
> But according to a yourkit profiling run this takes about 0.5% of the total request time for my application (which normally make me ignore such things, and I still find it very hard to believe), but because it's such an easy change we should do it.
> A quick-and-dirty test shows, that 
> {noformat}
> for (int i=0;i<100000;i++) {
>     	int result = Integer.valueOf(value);
>  }
> {noformat}
> takes 300% of the execution time of 
> {noformat}
> for (int i=0;i<100000;i++) {
>     	int result = Integer.parseInt(value);
>  }
> {noformat}
> (both running on Java 1.8.0_65)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)