[Haskell-cafe] Can Haskell outperform C++?
roman.werpachowski at gmail.com
Fri May 18 13:45:12 CEST 2012
> Date: Fri, 18 May 2012 15:30:09 +1200
> From: "Richard O'Keefe" <ok at cs.otago.ac.nz>
> Subject: Re: [Haskell-cafe] Can Haskell outperform C++?
> To: Roman Werpachowski <roman.werpachowski at gmail.com>
> Cc: haskell-cafe at haskell.org
> Message-ID: <B43B8CE3-9F90-4DC3-8725-D622983973F3 at cs.otago.ac.nz>
> Content-Type: text/plain; charset=us-ascii
> On 17/05/2012, at 10:07 PM, Roman Werpachowski wrote:
>>> No slide deck required. The task is "generating alternating permutations".
>>> Method 1: generate permutations using a backtracking search;
>>> when a permutation is generated, check if it is alternating.
>>> Method 2: use the same backtracking search, but only allow extensions
>>> that preserve the property of being an alternating permutation.
>> what makes Method 2 so much harder than Method 1 to implement in C or C++?
> It was me, not Gregg.
My apologies to you and Gregg.
> There was and is no claim that method 2 is "much harder
> to implement in C or C++". In fact both methods *were* implemented easily in C.
OK, got that now. So Haskell doesn't have a *big* advantage over C w/r
to the ease of implementation of both algorithms?
> The claim was and remains solely that
> THE TIME DIFFERENCE BETWEEN *ALGORITHMS*
> can be bigger than
> THE TIME DIFFERENCE BETWEEN *LANGUAGES*
> and is in this particular case.
Yes, but aren't the differences in the same ballpark, and if we want
to compare *languages*, we should use identical algorithms to make the
> (And that's despite the fact that the C version kept the set of unused
> elements as a one-native-word bit mask, while the Prolog version kept it
> as a linked list.)
> There is also a second claim, which I thought was uncontentious:
> the relative difficulty of tasks varies with language.
It matters much less if you write the code to be run multiple times.
More information about the Haskell-Cafe