Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/19860
  
    OK. I see the intention here now. I'm not sure if it does considerable
    impact, especially smaller functions will be inlined IIUC.
    
    If it has impact not ignoring, it should be worth doing.
    
    On Dec 3, 2017 1:56 PM, "Marco Gaido" <notificati...@github.com> wrote:
    
    @viirya <https://github.com/viirya> sorry, I don't understand your question.
    In Coalesce, we need to find the first non-null element. As soon as we find
    one, we don't need to evaluate anything else. Previously, the code
    generated by coalesce would have been:
    
    methodName_1();
    methodName_2();
    ...
    methodName_X();
    
    and in each method we were using ${ev.isNull} to avoid the computation of
    the unnecessary expressions, after the first non-null condition was met.
    In this case, even though we are doing nothing inside these function we are
    still calling all them and this is not cheap, as pointed out by @gatorsmile
    <https://github.com/gatorsmile> here: #19752 (comment)
    <https://github.com/apache/spark/pull/19752#discussion_r153081547>.
    Thus, in the new generated code, we avoid calling the methods when it is
    not necessary, since the generated code is:
    
    do {
      methodName_1();
      if (!isNull_1234) {
        continue;
      }
      ...
    } while (false);
    
    —
    You are receiving this because you were mentioned.
    Reply to this email directly, view it on GitHub
    <https://github.com/apache/spark/pull/19860#issuecomment-348742568>, or mute
    the thread
    
<https://github.com/notifications/unsubscribe-auth/AAEM9zsYPO_0A1a19ws-EuQtcTch6_F4ks5s8jf_gaJpZM4QyVuP>
    .



---

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

Reply via email to