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

Getting all visible methods in ReferenceTypeImpl is slow

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-svc
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b24

      Backports

        Description

        A number of code generation frameworks generate code with thousands of methods. JDI uses a O(all_methods * visible_methods) algorithm to return the list of methods. This can easily be made into a O(all_methods) method by doing the following:

        --- a/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java Thu May 01 14:21:29 2014 -0700
        +++ b/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java Thu May 08 10:28:23 2014 -0700
        @@ -529,7 +529,7 @@
                  * to filter that ordered collection.
                  */
                 List<Method> list = allMethods();
        - list.retainAll(map.values());
        + list.retainAll(new HashSet<Method>(map.values()));
                 return list;
             }

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                egahlin Erik Gahlin
                Reporter:
                jmanson Jeremy Manson
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: