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

Outdated performance advice in StringCoding

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9, 10
    • Fix Version/s: 10
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b04

      Description

      Class.getClassLoader0 was once an expensive native operation, but since JDK-6642881 was fixed it is now a simple getter, retrieving a final field injected during class load. Thus the advice in StringCoding that getClass().getClassLoader0 is expensive is now wrong.

      While JDK-8047735 may prove to make the getSecurityManager calls faster in the future, it seems like we should at least clean up the advice and possibly flip statements that are checking getSecurityManager since always having a volatile read is now likely the relatively more expensive operation here, e.g.:

        boolean isTrusted = System.getSecurityManager() == null ||
          cs.getClass().getClassLoader0() == null;

        Attachments

          Activity

            People

            Assignee:
            redestad Claes Redestad
            Reporter:
            redestad Claes Redestad
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: