Sorting a TOrdCollection...

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Fri May 30 1997 - 15:16:45 MEST


Hi Jim,

   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:

dkdkfrlkjf jfdlkj dflj  jdslkjf cdfghbaap198524
dkdkfrlkjf jfdlkj dflj  jdslkjf cdfghbaap897857
dkdkfrlkjf jfdlkj dflj  jdslkjf cdfghbaap127547

stored in a TOrdCollection or TObjArray in 85 seconds.
After some profiling I got it down to 79 seconds making
one trivial change. Of the 79 seconds most is spent
in memcmp. 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. What is the average length or you strings?

If you still have problems send me a small example
demonstrating the problems.

Cheers, Fons.


> Greetings,
> I have a TOrdCollection of TObjStrings that I want to sort. I
> used the Sort() method in the TOrdCollection class but it seems VERY
> slow. It took about 400 CPU second on a Dec Alpha to sort a
> TOrdCollection containing 22,000 TObjStrings. This seems to take
> longer than it should and I eventually will need to sort a
> TOrdCollection with over 1,000,000 TObjStrings. Am I doing something
> wrong? Is there a way to speed it up?
> Jim



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