Ceki G�lc� wrote:


Bonjour Fr�d�ric,

Thanks you for initiating this discussion.

My tests show  that the in the LinkedList loop the  inside of the loop
is never exercised.

 static double loopLinkedList() {
    long before = System.currentTimeMillis();
    ListIterator litcc;
    for(int i = 0; i < RUN_LENGTH; i++) {
      litcc = llhead;
      while(litcc.hasNext()) {
        tmp = (String) litcc.next();   <---- WE NEVER GET HERE
      }
    }
   ... etc


I very much doubt that any abstract data structure found in java.util.* can compete with the specialized structure we currently have for looping on filters. The current stuff is limited in functionality but highly optimized for the task.

To justify this  pompous assertion, I'd like to note  that in tests on
my   machine  the   current   code  is   faster   than  just   calling
litcc.hasNext()  method only *once*  in the  conditional of  the while
loop within loopLinkedList()  method. I mean while the  chain with the
current code in the time  the chained data structure completes a whole
loop around the  filter chain, the linked list  structure is only able
to  invoke the  hasNext() method  of  the iterator  just once  without
actually looping through the elements of the data structure.



At 10:05 PM 9/27/2004, Fr�d�ric Delanoy wrote:

Hi all,

I made some tests in org.apache.log4j.performance.ListVsVector.
(Whose purpose is "Compares the performance of looping through a list
versus a Vector.")

You said there that "Chain looping is *20* times faster than vector
access on JDK 1.1.7B on NT".

I made the same test with jdk1.4.1_01 on Windows 2000 ; it seems that
Vector are "only" little more than 3 times slower.

<...>

Excuse all. I should have double checked my results...
The javadoc should nevertheless IMHO be updated so as to reflect the current difference between Vector and Chain. (i.e. 3 times slower instead of 20)



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to