Re: Sorting a TOrdCollection...

From: Sverre JARP (Sverre.Jarp@cern.ch)
Date: Tue Jun 03 1997 - 07:03:27 MEST


Fons Rademakers wrote:
> 
>    I finally had some time to investigate this problem.
> On my PPro 200 Linux box I was able to sort 1.000.000
> TObjStrings of the form: 
> [snip]
> stored in a TOrdCollection or TObjArray in 85 seconds.
 About 130 MB was used for this test and
> my machine has 256 MB.
> 
> Anyway the 79 seconds for 1.000.000 strings is not
> too bad. So now the question is: what happened in
> your case where it took 400 CP seconds to sort 22.000
> strings. 

Fons and Jim,
Here is my view on the problem:
The QSORT algorithm is fine if you have enough memory, but it seems to
drive the paging disks crazy if you don't.
This morning I tried Fons's example on a NT machine with 96 MB but I
gave up waiting for it to terminate !!
Then I reduced the size to 500.000 strings (the space requirement is
then 65-70 MB) and the unoptimised version of the example terminated in
39 seconds !
So with this algorithm the rule seems to be: Make sure you have enough
REAL memory to hold the whole TObjArray.
Sverre
_________________________________________________

Sverre Jarp            Email: Sverre.Jarp@Cern.CH
IT Department          Phone: +41.79.201.0134
CERN                   Phone at CERN: 16.0134
CH- 1211 Geneva 23     Fax:   +41.22.767.7155
_________________________________________________



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:19 MET