Github user michaelandrepearce commented on the issue:

    https://github.com/apache/activemq-artemis/pull/1263
  
    ```
    public class Boxing {
        
        
        public static void main(String... args){
            
            //ensure we max'd out the caching magic.
            for (long i = 0; i < 100000000; i++){
                Long v = Long.valueOf(i);
            }
            
            int times = 1000000000;
            
            long startreference = System.nanoTime();
            reference(Long.valueOf(1000000001), times);
            long endreference = System.nanoTime();
    
            long startprimitive = System.nanoTime();
            primitive(1000000001l, times);
            long endprimitive = System.nanoTime();
    
            long startboxing = System.nanoTime();
            boxing(1000000001, times);
            long endboxing = System.nanoTime();
    
    
            long startunboxing = System.nanoTime();
            unboxing(Long.valueOf(1000000001), times);
            long endunboxing = System.nanoTime();
    
    
    
            System.out.println("reference   :" + (endreference - 
startreference));
            System.out.println("primitive   :" + (endprimitive - 
startprimitive));
            System.out.println("boxing      :" + (endboxing - startboxing));
            System.out.println("unboxing    :" + (endboxing - startboxing));
    
        }
        
        
        
        public static Long reference(Long number, int times){
    
            Long value = null;
            for(int i = 0; i < times; i++)
                value = number;
    
            return value;
        }
    
        public static Long boxing(long number, int times){
    
            Long value = null;
            for(int i = 0; i < times; i++)
                value = number;
    
            return value;
        }
    
    
        public static long primitive(long number, int times){
    
    
            long value = -1;
            for(int i = 0; i < times; i++)
                value = number;
            
            return value;
    
        }
    
        public static long unboxing(Long number, int times){
    
    
            long value = -1;
            for(int i = 0; i < times; i++)
                value = number;
    
            return value;
    
        }
    }
    ```
    
    
    ```
    reference   :1470275
    primitive   :934418
    boxing      :4394771377
    unboxing    :4394771377
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to