You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Jörg Hoh (JIRA)" <ji...@apache.org> on 2016/06/30 20:48:10 UTC

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

Jörg Hoh created FELIX-5287:
-------------------------------

             Summary: [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.8
            Reporter: Jörg Hoh
            Priority: Minor


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)