Faster sort?

Andrea Fontana via Digitalmars-d digitalmars-d at puremagic.com
Thu Apr 7 02:04:18 PDT 2016


On Thursday, 7 April 2016 at 09:00:05 UTC, Andrea Fontana wrote:
> What about this?
>
>    Duration total;
>
>    foreach(_; 0..10000)
>    {
>       auto arr = generate!( () => uniform(0,2)).map!(x => 
> cast(bool)x).take(65536).array;
>       StopWatch sw;
>       sw.start;
>       auto t = boolSort(arr);

Missed total+=...

>       sw.stop;
>       size_t sum = 0;
>       foreach(x; t.map!(x => x?1:0)) sum+=x;
>       writeln(sum);
>    }


whoops i missed a line there. It's 300ms but i wonder if test is 
valid. Anyway, that's not the point of my original post :)


More information about the Digitalmars-d mailing list