Boost logo

Boost :

Subject: Re: [boost] sorting library proposal (Was: Review Wizard Status Report for June 2009)o
From: Steven Ross (spreadsort_at_[hidden])
Date: 2009-06-03 13:25:42


What would your recommend?
hybrid_float_sort?

Also, with the O(nlog(n)) performance issue, introsort guarantees O(nlog(n))
performance.
True, somebody could use something else for their std::sort implementation,
but my only alternative is to put introsort into my algorithm directly,
which makes the algorithm much less modular and adds additional source to
maintain where the need is questionable,
along with not taking advantage of possible machine-specific optimizations
in the provided standard library implementation.

On Wed, Jun 3, 2009 at 9:37 AM, Vladimir Prus <vladimir_at_[hidden]>wrote:

> Steven Ross wrote:
>
> > You can sort floats by casting them to integers and accounting for the
> > flipped representation of negatives.
> > Comparison-based sorting of floats is over an order of magnitude slower
> on
> > x86 systems I've tried relative to an old Altivec.
> > On the Altivec runtime of comparison-based sorting of floats is
> comparable
> > to that for sorting integers.
>
> Then, should you actually have this:
>
> BOOST_STATIC_ASSERT(sizeof(Cast_type) == sizeof(Data_type));
> BOOST_STATIC_ASSERT(std::numeric_limits<Data_type>::is_iec559);
> BOOST_STATIC_ASSERT(std::numeric_limits<Cast_type>::is_integer);
>
> I would have expected sorting to work on whatever I throw to it -- a user
> might
> not even know what iec559 is. In other works, can you enable cast to int
> conditionally?
>
> And while we are at it, I am not sure that 'float_sort' is good name -- it
> is very
> generic and closes the door for different algorithm that might sort floats.
>
> - Volodya
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk