ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Bug 53637] New: performance problem in VectorSet.allAll()
Date Thu, 02 Aug 2012 00:29:18 GMT

          Priority: P2
            Bug ID: 53637
           Summary: performance problem in VectorSet.allAll()
          Severity: normal
    Classification: Unclassified
                OS: Linux
          Hardware: PC
            Status: NEW
           Version: 1.8.4
         Component: Core
           Product: Ant

Created attachment 29149

There is a performance problem in VectorSet.allAll().  It appears in
version 1.8.4 and also in revision 1367821.  I attached a test that
exposes this problem and a patch that fixes it.  On my machine, the
patch provides a 20X speedup for this test.

To run the test, just do:

$ java Test

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

The output for the patched version is:
Time is 22

The current implementation of "VectorSet.addAll(int index, Collection
c)" adds the elements of "c" one by one at "index" in the
"elementData" array.  These add operations are slow, because each of
them requires shifting to the right all the elements after "index".

The attached patch adds all the elements at once, and thus performs a
single shift.

The java.util.ArrayList "addAll(int index, Collection<? extends E> c)"
implementation also performs a single shift (like the patch), and does
not insert the elements one by one.

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

View raw message