ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 53637] New: performance problem in VectorSet.allAll()
Date Thu, 02 Aug 2012 00:29:18 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=53637

          Priority: P2
            Bug ID: 53637
          Assignee: notifications@ant.apache.org
           Summary: performance problem in VectorSet.allAll()
          Severity: normal
    Classification: Unclassified
                OS: Linux
          Reporter: nistor1@illinois.edu
          Hardware: PC
            Status: NEW
           Version: 1.8.4
         Component: Core
           Product: Ant

Created attachment 29149
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29149&action=edit
patch

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.

Mime
View raw message