ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Bug 53822] New: performance of IdentityStack.containsAll()
Date Mon, 03 Sep 2012 18:45:37 GMT

          Priority: P2
            Bug ID: 53822
           Summary: performance of IdentityStack.containsAll()
          Severity: normal
    Classification: Unclassified
                OS: Linux
          Hardware: PC
            Status: NEW
           Version: 1.8.4
         Component: Core
           Product: Ant

Created attachment 29322

"IdentityStack.containsAll(Collection coll)" has a similar performance
problem as the previously fixed Bug 53622 (for
"VectorSet.retainAll(Collection coll)").  The problem is that
"containsAll(Collection coll)" performs "this.contains(",
which is slow because "this" is an IdentityStack, i.e., a Vector, and
therefore "contains" is linear.

I attached a patch (patchSmall.diff) similar to the one used by Jesse
Glick in Bug 53622.  I attached an improved patch (patchFull.diff)
that builds the IdentityHashMap lazily, which gives slightly better
performance than patchSmall.diff (which builds IdentityHashMap
eagerly).  I also attached a test that exposes this problem.  For this
test, patchSmall.diff provides a 676X speedup on my machine.

To run the test, just do:

$ java Test

The output for the un-patched version is:
Time is 17572

The output for the patched version is:
Time is 26

You are receiving this mail because:
You are the assignee for the bug.

View raw message