[m-dev.] Re: The Great Computer Language Shootout

Ralph Becket rbeck at microsoft.com
Wed Jan 10 04:26:14 AEDT 2001


I've knocked out about half a dozen of the Shootout benchmarks in
Mercury (it's not terribly scientific, as the site author admits,
but Don Syme here is asking for people to write these sorts of
things for .NET testing.)  If people can see any obvious optimizations 
that I've missed, please let me know.

The Mercury versions may lose out slightly against C etc. on some tests
merely because they're more robust, which is effort well spent in
my book.

However, it has thrown up two fairly obvious holes we ought to
fill if we're to compete properly in these things.

1. The library needs a hash table implementation or two (open and
closed will do) since map/2 is not as efficient in those cases 
where one expects to be indexing large amounts of data.

2. The library could do with a `soft parsing' module; something akin
to C's scanf  [I have a foreboding sense of impending doom that 
R.A.O'Keefe is going to come down on this one like a ton of bricks...]
or, perhaps more sensibly, a decent set of parsing combinators
(or whatever) optimised for simple stuff (ints, `words' etc.)

I have a mostly working lexer module somewhere and a totally untested
monadic parser combinator library if anyone wants to take them over
and make them useable.

A less important observation:

3. We could do with a few utility functions in the library that
do things like iterate a function until some condition is reached and
iterate over a range of the integers.  It happens more than you might
imagine, out there.

The forthcoming sequence quantifiers will do the trick, but it's
probably only an hour's work to add these things to the library now.
Any strong feelings on how the interface should look?

Cheers,

Ralph

--
Ralph Becket      |      MSR Cambridge      |      rbeck at microsoft.com 


begin 600 mercuryshootout.tgz
M'XL(`.=#6SH``^T<:W/;-C*?_2LPGO$<>:55DGHXT<6=BYOF[%369:RT=<;Q
M,8P$V9SPH2.IN&[:_WZ[`$@")"TI/DMV$NZT#A^[`':QQ#ZPD!O'[K4['M,D
M:06/U at .F99J]7N>1:<)5VY3_1;"[[;U'YIYM]WIMV^S:@&]W>KU'Q%S3>!28
M)ZD;$_(H?D_''Q;@+7O_A<(.V;U#(#M;.\2550KN3UQ_=DD.0'PT)4^9'/\9
M>.,X2J)IVAI'P0^`]'I.R4LW).0)L;K]3J??[I!_';\F-N@*O/[H!7V2)OL=
MDES!'V at HO=HWR54`?Z;3_7GH_;Z%?=\Q,UO]71)$D[E/%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.VC_VQV[L?^;@'78?TFE-FS][Y at 7V9P63-V_,?T<:UJ;_%&L
M*["&YH at 5,;"#LK7&:EAKD!A_2@/%-L,2CDM4-^5,%+31/,!SC//@CHLX*IV0
M[XB;1AY'XSVN6,(!J/""M7'G)1R2$\!&5UA_OC7''H[R at L6Z,!ZK$LN1?I'Z
MDYT?HY0[\!+0 at CR!,/$N/-Q)'.E2^%P<Y[_O9:V!%0'G=@I+Q3I/@"[;_['M
M//[O];KL]_]LJ_G]OXW`&NR_I%)?C?DO>/JRK;^!N=BJ"\!K.I!)AW$I;\V\
M@`?'[BPOACG-=P38CX`4)H1M#?R\^RO:HU]W?S9XVA>,B9LDT9 at 7D6:-U?V8
M#D,XA>@7*U>(^($=P&?C4O/R=>/-=J_8#\R6[POYUXF_TMS-[D@%57!D%H+:
M=%)?-<SXN;FZD:&`^/WHBL:\O5*#O\PF(`CA+F2@\2,)(V"(;?+4)_79W";4
MC<>7VHMC]KL_P[I?"&8YAQ?Y1M&(;12QHI6;LOQEY"IB*;>?WRF\B=FP2OM7
MG.5\ERJ;/44P-\VQ5<SQ9VQ<"1)XE76VN?VKTD>DS5PO5A)'2[WT<@NUFUIE
M)&24[#(9JU]#5KVVLS=YF^[@SO&9Q[!A((G&\,^;\IT&&FB@@08::*"!!AIH
:H($&&FB@@08::*"!!AKX?^%_V=%`@P!X```=
`
end
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list