Intel vs AMD sorting 
Author Message
 Intel vs AMD sorting

I am running on Intel Pentium 4 on 1.7GHz machine and the results are just
like described by you on the AMD machine. It seems that the new processors
behave this way, maybe because of the parallelism, maybe because of the
better cache...
The fact that qsort performs worse than the stable_sort comes from having
too much equal values in you array:
rand() returns values under 32000, while you are having 1 000 000 integers.
QSort doesn't behave so well on this kind of data.
If you lower the size of the array (but then you should use
QueryPerformanceCounter for measuring time), or change the fill algorithm on
s'th like

list.push_back( new Object( /*rand()*/ i  ) );

you would see, that qsort will become faster.

Regards,
Boris


Quote:
> Hi

> I tested std::stable_sort, std::sort on both my AMD(2.0Gz)
> and Intel(750Mhz) based computers.  Guess what?  With the
> same set of randomized vector and comparison functor,
> std::stable_sort is performing better than std::sort on
> the AMD machine!  What gives? The Intel one gave the
> expected answer, that is sort is better than stable_sort.

> As a comparison, I also did C's qsort and MergeSort (my
> colleague copied that from somewhere), and the AMD gave
> the same kind of result, the MergeSort one is better than
> qsort, while it was the other way around (the expected
> one) on the Intel.

> Could someone tell me what's happening here?  I included
> the test project for reference, please look at it if you
> want to know better about how I tested them.

> Thanks,
> danny



Sat, 01 Jan 2005 20:58:01 GMT  
 Intel vs AMD sorting

Quote:
> As a comparison, I also did C's qsort and MergeSort (my
> colleague copied that from somewhere)

Microsofts version of qsort() is poor.
A better version is Bentley & McIlroy's version of qsort() written in 1993,
presened in the paper "Engineering a Sort Function", with 3-way
partitioning. This is used by a many compiler vendors these days

See
http://cm.bell-labs.com/cm/cs/who/doug/qsort.c

Also try testing Microsofts qsort() using code
http://www.cs.dartmouth.edu/~doug/aqsort.c

Stephen Howe



Mon, 03 Jan 2005 00:34:50 GMT  
 Intel vs AMD sorting

Quote:
>A better version is Bentley & McIlroy's version of qsort

() written in 1993,

I thought that I shouldn't use C's algorithms anymore,
because they can't be inlined.  That's why I tried the
different versions, just to test how expensive function
calls are while sorting.

On the project I attached, std::sort with a functor was
twice as fast as the qsort/mergesort with my Pentium 3 750
Mhz machine (a vaio laptop).  The sort took about 1.6
second.  Funny on my AMD 2 (which supposed to be equal to
Pentium 4 2Ghz, as they claimed) it took 2+ seconds.  All
other sorting did better slightly though.  Is there
something I need to know here?

Thanks for the input.

danny



Wed, 05 Jan 2005 01:45:25 GMT  
 Intel vs AMD sorting

Quote:

> On the project I attached, std::sort with a functor was
> twice as fast as the qsort/mergesort with my Pentium 3 750
> Mhz machine (a vaio laptop).  The sort took about 1.6
> second.  Funny on my AMD 2 (which supposed to be equal to
> Pentium 4 2Ghz, as they claimed) it took 2+ seconds.  All
> other sorting did better slightly though.  Is there
> something I need to know here?

Whether an AMD or an Intel is faster depends greatly on what the
bottleneck is.  Intel excels at memory bandwidth-limited cases, AMD
excels at floating point-limited cases.  And I'm not sure about the
stuff doesn't fall into one of these two groups.


Wed, 05 Jan 2005 02:45:38 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. AMD vs Intel Processors for VC6++

2. Floating Point Precision in VC++ between Intel/AMD

3. AMD crashes -- Intel doesn't

4. Will Windows only run on AMD/Intel?

5. Alpha-blended icons on REBAR amd ListView (XP vs Win-2000)

6. Quick sort vs. bubble sort

7. Cyrix, vs. Intel

8. Intel c/86 vs Microsoft C V6.0

9. amd now, intel mmx,... ??

10. VS.NET - sorting the project files without case ???

11. How to sort VS.NET project folder files?

12. CListCtrl vs sorting items

 

 
Powered by phpBB® Forum Software