Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8223504

improve performance of forall loops by better inlining of "iterator()" methods.

    Details

    • Subcomponent:
    • Resolved In Build:
      b24
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        If forall loop is used for traversing big enough collection C2 doesn't inline the iterator() method. That is caused by MinInliningThreshold option. iterator() is invoked in loop prolog and for enough number of iterations loop prolog is considered as cold code in comparison to the loop body. Practical boundary is approximately 1500 elements of collection. For smaller collections iterator() is inlined, for larger collection - not inlined.
        The fact that iterator() method is not inlined leads to not performed scalar replacement for the Iterator object. Allocation cost of the single Iterator object traversing large enough collections is negligible. However, if Iterator state has reverences (which are updated on each step), GC write barriers are invoked and GC barriers have a large cost to iteration. When Iterator object is scalarized - no need for GC barriers invocation.

        Other part of discussion is here http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2019-February/032623.html

        Microbenchmarks targeting that for different collections could be found here http://cr.openjdk.java.net/~skuksenko/hotspot/8223504/benchmark/

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  skuksenko Sergey Kuksenko
                  Reporter:
                  skuksenko Sergey Kuksenko
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: