Parallel Rogue-like benchmark

Russel Winder russel at winder.org.uk
Mon Aug 26 05:04:50 PDT 2013


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.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130826/d6c7d977/attachment.pgp>


More information about the Digitalmars-d mailing list