Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1218

EqualsBuilder.append(Object,Object) is too big to be inlined, which prevents whole builder to be scalarized

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.4
    • 3.5
    • lang.builder.*
    • None

    Description

      Method EqualsBuilder.append(Object,Object) is 327 bc long, while current JIT hot methods inlining threshold (-XX:FreqInlineSize) = 325. Because of this, .append(Object,Object) is not inlined: with -XX:+PrintInlining -XX:+PrintCompilation following messages could be seen

      ....
        @ 13   o.a.c.l.b.EqualsBuilder::append (327 bytes)  hot method too big 
      ....
      

      Fail of inlining, by itself, is not so bad – just a bit penalty to performance. But crucial thing here: without all method being inlined Escape Analysis also fails to trace Builder instance lifespan, and fails to prove it NoEscape. This, in turn, leads EqualsBuilder to be really allocated on heap.

      The funny thing here is: with .append(O,O) being just 2-3 bytecodes smaller, most of EqualsBuilder usage scenarios will be scalarized

      Attachments

        Activity

          People

            Unassigned Unassigned
            cheremin Ruslan Cheremin
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: