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

Getting all visible methods in ReferenceTypeImpl is slow

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 9
    • core-svc
    • b24

        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;
             }

              egahlin Erik Gahlin
              jmanson Jeremy Manson (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: