Parallel Rogue-like benchmark
deadalnix
deadalnix at gmail.com
Mon Aug 26 05:31:26 PDT 2013
On Monday, 26 August 2013 at 12:05:09 UTC, Russel Winder wrote:
> On Mon, 2013-08-26 at 00:57 +0200, Joseph Rushton Wakeling
> wrote:
>> On 24/08/13 19:01, Ramon wrote:
>> > I think that there is a lot speaking against sloc.
>> >
>> > First it's often (ab?)used for "Ha! My language x is better
>> > than yours. I can
>> > write a web server in 3 lines, you need 30".
>>
>> Don't know about a web server, but I remember somewhere online
>> I found this really cool 3-line quicksort that you can do in
>> Haskell :-)
>>
>> qsort [] = []
>> qsort (x:xs) = qsort (filter (< x) xs) ++ [x]
>> ++ qsort (filter (>= x) xs)
>
> OK so good for the first 20s of a lecture on Quicksort and
> totally
> useless for doing anything properly. Two main reasons:
>
> 1. It copies data rather than doing it in situ, should use
> Mergesort.
> 2. passes over the data twice instead of once.
>
> This is a perfect example of where minimizing LOC and doing the
> right
> thing are opposed.
It goes throw data 3 times : to filter (twice) and to to concat
at the end.
More information about the Digitalmars-d
mailing list