[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: benchmarks - sort
From: |
David Bateman |
Subject: |
Re: benchmarks - sort |
Date: |
Wed, 14 Jan 2004 12:12:51 -0600 |
User-agent: |
Mutt/1.4.1i |
Well, for the hell of it I programmed a simple sort oct-file to test
what would be faster (IEEE754 integer compare or floating point compare
with checking for Inf and NaN), you can check the attached oct-file.
One complication of IEEE754 is the symmetry of negative and postive numbers.
This means that positive and negative tests need to be treated seperately, as
opposed to a 2's complement respresentation
The code at the moment is only for a row vector and is attached the example
I used was
a=randn(1,100000); a(1) = NaN; a(2) = -Inf; a(3) = Inf; tic; mysort(a); t =
toc; tic; mysort(a,1); t1= toc; t, t1
And I got the result
t = 0.27054
t1 = 0.23212
showing that IEEE754 integer compares are about 20% faster.... Well
IEEE754 is faster, but it is certainly not a factor of 10 faster...
Seems like we need to look elsewhere for this order of magnitude
increase...
Regards
D.
According to Schloegl Alois <address@hidden> (on 01/06/04):
> Zitat von Paul Kienzle <address@hidden>:
>
> >
> > Paul Thomas pointed me to these benchmarks. Anybody want to do
> > something about them?
> >
> > http://www.sciviews.org/other/benchmark.htm
> >
>
> ...
>
> >
> > I.C Matlab 0.89 - Octave 7.77
> > b = sort(a);
> >
> > Octave's sort is surprisingly slow. 3x worse than any other package
> > mentioned. Anyone know a fast stable sort algorithm?
> >
>
>
> One reason, for the bad performance of the sort algorithm might be the
> exception
> handling of NaNs. See also
> http://www.octave.org/octave-lists/archive/bug-octave.2001/msg00047.html
>
> Sorting on the binary level might be helpful, because the bit patterns of the
> IEEE754 numbers provide the correct sorting order. This is
> -inf < -1 < 0 < 1 < inf < NaN
>
> Just my few thougths.
>
>
> Alois
>
--
David Bateman address@hidden
Motorola CRM +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax)
91193 Gif-Sur-Yvette FRANCE
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
mysort.cc
Description: Text document
- benchmarks, Paul Kienzle, 2004/01/05
- Re: benchmarks, David Bateman, 2004/01/06
- Re: benchmarks - sort, Schloegl Alois, 2004/01/06
- benchmarks, John W. Eaton, 2004/01/06
- packages (was: benchmarks), John W. Eaton, 2004/01/06
- randn benchmarks, David Bateman, 2004/01/22