[Shootout-list] fannkuch benchmark for GHC
Dmitry Astapov
dastapov@gmail.com
Mon, 10 Jan 2005 11:09:42 +0200
Evening, Isaac.
Isaac Gouy <igouy2@yahoo.com> 09:55 6/1/2005 wrote:
>> Attached is a fannkuch benchmark for GHC, made in the same spirit as,
>> for example, Python one - it uses reverse traversal of the search
>> space to finish faster.
IG> Fannkuch is supposed to be a test of indexed-access to a collection.
Well, one the one hand, straightforward haskell solution (as proposed by
Greg Buchholz) or my optimized one does not (syntactically) access
collections by index. Same applies, by the way, to solution in Erlang.
On the other hand, both solutions feature heavy list processing (reversing
parts of list, and composition/decomposition of lists to build
permutations). I think that such operations (which basically traverse list
or it's portion) could be considered to satisfy definition of
"indexed-access to a collection".
If it is required for a solution to feature idexed access on the syntactic
level, this will imply a use of loops to organize such access, and loops
are alien to a recursive style of programming natural to haskell (to say
the least).
If it is indeed required - then what's the point in admitting
"higher-level" languages and then requiring to program in them "like in C"
? :)
IG> Is this program and the Python program faster because it does fewer
IG> accesses to the collection? (Better algorithm not faster access).
Fewer compared to what? If we compare to the "naive" implementation in same
language, then answer is yes - because it does same amount of operations,
but on the limited data set.
If this kind of optimization is not allowed, then Greg's solution should be
accepted and mine - rejected. After all, it's 25% shorted (in lines) :)
--
Dmitry Astapov //ADEpt
GPG KeyID/fprint: F5D7639D/CA36 E6C4 815D 434D 0498 2B08 7867 4860 F5D7 639D