[Shootout-list] Haskell killer prodcons implementation - fair?

Brent Fulgham bfulg@pacbell.net
Sat, 02 Oct 2004 16:46:11 -0700


On 2004-10-02 04:32:57 -0700 Einar Karttunen <ekarttun@cs.helsinki.fi> 
wrote:

> Hello
> 
> The following ghc prodcons implementation tests to 0.028 sec (with
> N=150000) on my machine. This means that it is maybe the fastests
> existing for prodcons. Now for the real question - is it fair?
> 
> The used concurrency abstraction MVar is the basic one in concurrent
> haskell. The code is overcommented to help people with less haskell 
> experience.

It seems fair.  The MVar construct provides the concurrency 
synchronization
we need to verify that one "thread" is not reading the value at the 
same time
the other is writing to the buffer.

Just out of curiousity, can an MVar be such that it could hold several 
values
(e.g., a string, or a structure of some kind)?

At any rate, the Haskell implementation follows the intent of the 
test, and I
see no reason to disallow it.

I also want to thank Einar and Aaron Denney for their recent rash of 
Haskell
updates.  I've learned quite a few new things about Haskell recently.  
I may
have to start playing with it again!  :-)

Thanks,

-Brent