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

ZGC: Avoid overhead of sorting ZStatIterableValues on bootstrap

    XMLWordPrintable

Details

    • Enhancement
    • Status: Resolved
    • P5
    • Resolution: Fixed
    • 16
    • 16
    • hotspot
    • gc
    • b18

    Description

      Startup profiles show some small, unnecessary overhead in static initializers creation various ZStat objects, and part of that is due comparing names in ZStatIterableValue::insert even when the insertion order is defined by group name.

      gcc doesn't see through strcmp and optimize this so that the strcmp on name is only done when needed, so we need to move the comparison on name into the test:

         // First sort by group, then by name
          const int group_cmp = strcmp((*current)->group(), group());
          if ((group_cmp > 0) || (group_cmp == 0 && strcmp((*current)->name(), name()) > 0)) {
            break;
          }

      This avoids a tiny amount of work (~30k insns) on bootstrap.

      Additionally, the sorting can be deferred completely to when starting the ZStat service, which removes the remaining overhead when not running the stat service.

      Attachments

        Issue Links

          Activity

            People

              redestad Claes Redestad
              redestad Claes Redestad
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: