You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2020/01/22 18:51:26 UTC

[GitHub] [maven] rosti-il opened a new pull request #318: [MNG-6853] - Don't box primitives where it's not needed

rosti-il opened a new pull request #318: [MNG-6853] - Don't box primitives where it's not needed
URL: https://github.com/apache/maven/pull/318
 
 
   Following this checklist to help us incorporate your 
   contribution quickly and easily:
   
    - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/MNG) filed 
          for the change (usually before you start working on it).  Trivial changes like typos do not 
          require a JIRA issue.  Your pull request should address just this issue, without 
          pulling in other changes.
    - [ ] Each commit in the pull request should have a meaningful subject line and body.
    - [ ] Format the pull request title like `[MNG-XXX] - Fixes bug in ApproximateQuantiles`,
          where you replace `MNG-XXX` with the appropriate JIRA issue. Best practice
          is to use the JIRA issue title in the pull request title and in the first line of the 
          commit message.
    - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
    - [ ] Run `mvn clean verify` to make sure basic checks pass. A more thorough check will 
          be performed on your pull request automatically.
    - [ ] You have run the [Core IT][core-its] successfully.
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under 
   the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [ ] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
    - [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   [core-its]: https://maven.apache.org/core-its/core-it-suite/
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] rosti-il commented on issue #318: [MNG-6853] - Don't box primitives where it's not needed

Posted by GitBox <gi...@apache.org>.
rosti-il commented on issue #318: [MNG-6853] - Don't box primitives where it's not needed
URL: https://github.com/apache/maven/pull/318#issuecomment-577638662
 
 
   @olamy This can only improve the performance because the `Integer.valueOf()` calls to the `Integer.parseInt()` by itself. The `Integer.parseInt()` returns a primitive while the `Integer.valueOf()` returns an object. Even when `Integer.valueOf()` returns a cached object and doesn't create a new one it executes the cache range check. Just take a look at the code of `java.lang.Integer` in JDK8.
   
       public static Integer valueOf(String s) throws NumberFormatException {
           return Integer.valueOf(parseInt(s, 10));
       }
   
       public static Integer valueOf(int i) {
           if (i >= IntegerCache.low && i <= IntegerCache.high)
               return IntegerCache.cache[i + (-IntegerCache.low)];
           return new Integer(i);
       }
   
       public static int parseInt(String s) throws NumberFormatException {
           return parseInt(s,10);
       }
   
   `valueOf()` and `parseLong()` of Long and Boolean are implemented by the same way.
   
   Also the code I propose to change uses primitives, so this change prevents unnecessary unboxing, i.e. it can only improve the performance.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] rosti-il commented on issue #318: [MNG-6853] - Don't box primitives where it's not needed

Posted by GitBox <gi...@apache.org>.
rosti-il commented on issue #318: [MNG-6853] - Don't box primitives where it's not needed
URL: https://github.com/apache/maven/pull/318#issuecomment-578431343
 
 
   @namannigam I have run the Core IT successfully.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] asfgit closed pull request #318: [MNG-6853] - Don't box primitives where it's not needed

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #318: [MNG-6853] - Don't box primitives where it's not needed
URL: https://github.com/apache/maven/pull/318
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] slachiewicz commented on issue #318: [MNG-6853] - Don't box primitives where it's not needed

Posted by GitBox <gi...@apache.org>.
slachiewicz commented on issue #318: [MNG-6853] - Don't box primitives where it's not needed
URL: https://github.com/apache/maven/pull/318#issuecomment-578439698
 
 
   Thank you

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] olamy commented on issue #318: [MNG-6853] - Don't box primitives where it's not needed

Posted by GitBox <gi...@apache.org>.
olamy commented on issue #318: [MNG-6853] - Don't box primitives where it's not needed
URL: https://github.com/apache/maven/pull/318#issuecomment-577514171
 
 
   not sure about the performance effect of this but usually valueOf use some caching (read javadoc https://docs.oracle.com/en/java/javase/12/docs/api/java.base/java/lang/Integer.html#valueOf(int) )
   so can you prove this doesn't have any performance impact?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services