Bug 53821 - IdentityStack.removeAll() is slow
Summary: IdentityStack.removeAll() is slow
Alias: None
Product: Ant
Classification: Unclassified
Component: Core (show other bugs)
Version: 1.9.1
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: 1.9.4
Assignee: Ant Notifications List
Keywords: PatchAvailable
Depends on:
Reported: 2012-09-03 15:30 UTC by Adrian Nistor
Modified: 2014-01-02 14:37 UTC (History)
1 user (show)

patch (707 bytes, patch)
2012-09-03 15:30 UTC, Adrian Nistor
Details | Diff
test (641 bytes, text/x-java)
2012-09-03 15:31 UTC, Adrian Nistor

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Nistor 2012-09-03 15:30:21 UTC
Created attachment 29320 [details]

"IdentityStack.removeAll(Collection coll)" has the same performance
problem as the previously fixed Bug 53622 (for
"VectorSet.retainAll(Collection coll)").  The problem is that
"removeAll(Collection coll)" performs "coll.contains(e.next())", which
is slow if for example "coll" is a list.

I attached a patch similar to the one used by Jesse Glick in Bug
53622.  I also attached a test that exposes this problem.  For this
test, the patch provides a 97X speedup on my machine.

To run the test, just do:

$ java Test

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

The output for the patched version is:
Time is 26
Comment 1 Adrian Nistor 2012-09-03 15:31:16 UTC
Created attachment 29321 [details]
Comment 2 Stefan Bodewig 2014-01-02 14:37:56 UTC
svn revision 1554813