Github user kiszk commented on the issue:

    https://github.com/apache/spark/pull/19916
  
    Thank you for checking Java bytecode. I am talking about native code, not 
about bytecode. Hotspot compiler may eliminate statements.
    
    I think that this elapsed time includes interpreter execution, JIT 
compilation, and native code execution. It would be good to add warm-up.  
    I think that it is not the best to write a long-running loop in `main()` 
method since it leads to on-stack-replacement. It would be good to put the 
long-running target loop into a callee.  
    I think that it would be good to store a result into a global variable 
unlikely to eliminate unused variables and related operations.
    
    WDYT?
    
    ```
    Integer globalVar g;
    void targetMethod() {
       Integer b;
       for(long i = 0; i < 1000000000; ++ i){
         b += ((Integer)a) + 1;
       }
       g = b;
    }
    // warm up
    for (int i = 0; i < 10000000; i++) { targetMethod();}
    
    long start = System.currentTimeMillis();
    targetMethod();
    long end = System.currentTimeMillis();}
    ```


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to