Github user mgaido91 commented on the issue:

    https://github.com/apache/spark/pull/19916
  
    Thank you again very much for your comment @kiszk! Results are different 
now and they show a difference in performance.
    The code I am running is:
    ```
    public class A {
     private static Long g;
     
     public static void main(String[] args){
       A a = new A();
       long start = System.currentTimeMillis();
       a.testWithCast();
       long end = System.currentTimeMillis();
       System.out.println("Time for casting: " + (end-start));
       long start1 = System.currentTimeMillis();
       a.testWithoutCast();
       long end1 = System.currentTimeMillis();   
       System.out.println("Time without casting: " + (end1-start1));
      
     }
     
     public void testWithCast() {
        Object a = new Long(1);
        Long b = 0L;
        for(long i = 0; i < 1000000000; ++ i){
         b += ((Long)a);
       }
       g = b;
     }
     
     public void testWithoutCast() {
        Object a = new Long(1);
        Long al = (Long) a;
        Long b = 0L;
        for(long i = 0; i < 1000000000; ++ i){
         b += al;
       }
       g = b;
     }
    }
    ```
    
    and the results now are:
    ```
    ➜  janino_tests java A
    Time for casting: 3650
    Time without casting: 3360
    ➜  janino_tests java A
    Time for casting: 3682
    Time without casting: 3399
    ➜  janino_tests java A
    Time for casting: 3671
    Time without casting: 3347
    ➜  janino_tests java A
    Time for casting: 3743
    Time without casting: 3411
    ```
    Thus the time needed for casting is visible now. I am not sure, then, that 
replacing the old method is the right thing to do. WDYT?



---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to