Bug 53803 - performance problem in IdentityStack.retainAll()
Summary: performance problem in IdentityStack.retainAll()
Status: RESOLVED FIXED
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
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2012-08-30 18:43 UTC by Adrian Nistor
Modified: 2014-01-02 15:29 UTC (History)
1 user (show)



Attachments
patch (704 bytes, patch)
2012-08-30 18:43 UTC, Adrian Nistor
Details | Diff
test (643 bytes, text/x-java)
2012-08-30 18:44 UTC, Adrian Nistor
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Nistor 2012-08-30 18:43:47 UTC
Created attachment 29310 [details]
patch

IdentityStack.retainAll() has the same performance problem as the
previously fixed Bug 53622 (for VectorSet.retainAll()).  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 12X speedup on my machine.

To run the test, just do:

$ java Test

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

The output for the patched version is:
Time is 225

Similarly to Bug 53622, the problem is that "retainAll(Collection<?> c)" 
performs "c.contains(e.next())", which is slow if for example "c" is a
list.
Comment 1 Adrian Nistor 2012-08-30 18:44:27 UTC
Created attachment 29311 [details]
test
Comment 2 Stefan Bodewig 2014-01-02 15:29:54 UTC
svn revision 1554830