Github user mgaido91 commented on the issue:

    https://github.com/apache/spark/pull/19916
  
    I am reporting the result of my tests. I run:
    ```
    Object a = new Integer(1);
       long start = System.currentTimeMillis();
       for(long i = 0; i < 1000000000; ++ i){
         Integer b = ((Integer)a) + 1;
       }
       long end = System.currentTimeMillis();
       System.out.println("Time for casting: " + (end-start));
       long start1 = System.currentTimeMillis();
       Integer ai = (Integer) a;
       for(long i = 0; i < 1000000000; ++ i){
         Integer b1 = ai + 1;
       }
       long end1 = System.currentTimeMillis();   
       System.out.println("Time without casting: " + (end1-start1));
    ```
    In the compiled code there is an additional operation `checkcast` (both 
with janinoc and javac), but the performance result of running this seems 
telling that there in not a significant impact:
    ```
    ➜  janino_tests java A                            
    Time for casting: 305
    Time without casting: 311
    ➜  janino_tests java A
    Time for casting: 305
    Time without casting: 302
    ➜  janino_tests java A
    Time for casting: 309
    Time without casting: 293
    ➜  janino_tests java A
    Time for casting: 291
    Time without casting: 312
    ➜  janino_tests java A
    Time for casting: 297
    Time without casting: 294
    ```
    What do you think given these results? Should I go on with the PR and 
remove also the remaining `addReferenceObj`?
    Thanks.


---

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

Reply via email to