[Haskell-cafe] Can Haskell outperform C++?

Yves Parès yves.pares at gmail.com
Sun May 6 11:12:15 CEST 2012


Sorry sorry sorry ^^
I read too fast and realized I was wrong before you sent this.

Okay so then it would be nice that somewhere with higher skills tells us
where does Haskell recursive calls stand when compared to C's.

2012/5/6 Roman Cheplyaka <roma at ro-che.info>

> It is not tail-recursive.
>
> * Yves Parès <yves.pares at gmail.com> [2012-05-06 10:58:45+0200]
> > I do not agree: the fib function is tail-recursive, any good C compiler
> is
> > able to optimize away the calls and reduce it to a mere loop.
> > At least that's what I learnt about tail recursion in C with GCC.
> >
> > 2012/5/6 Artur <apeka1990 at gmail.com>
> >
> > > On 06.05.2012 10:44, Ivan Lazar Miljenovic wrote:
> > >
> > >> On 6 May 2012 16:40, Janek S.<fremenzone at poczta.onet.pl>  wrote:
> > >>
> > >>> Hi,
> > >>>
> > >>> a couple of times I've encountered a statement that Haskell programs
> can
> > >>> have performance
> > >>> comparable to programs in C/C++. I've even read that thanks to
> > >>> functional nature of Haskell,
> > >>> compiler can reason and make guarantess about the code and use that
> > >>> knowledge to automatically
> > >>> parallelize the program without any explicit parallelizing commands
> in
> > >>> the code. I haven't seen
> > >>> any sort of evidence that would support such claims. Can anyone
> provide
> > >>> a code in Haskell that
> > >>> performs better in terms of execution speed than a well-written C/C++
> > >>> program? Both Haskell and C
> > >>> programs should implement the same algorithm (merge sort in Haskell
> > >>> outperforming bubble sort in
> > >>> C doesn't count), though I guess that using Haskell-specific idioms
> and
> > >>> optimizations is of
> > >>> course allowed.
> > >>>
> > >> How about
> http://donsbot.wordpress.com/**2007/11/29/use-those-extra-**
> > >> cores-and-beat-c-today-**parallel-haskell-redux/<
> http://donsbot.wordpress.com/2007/11/29/use-those-extra-cores-and-beat-c-today-parallel-haskell-redux/
> >
> > >> ?
> > >>
> > >>  Hi,
> > >
> > >  isn't it that particular Haskell code is outperforming C (22 seconds
> vs.
> > > 33), just because the author uses recursion in C? I surely love
> Haskell,
> > > and the way it's code is easy parallelized, but that example seams not
> fair.
> > >
> > >
> > > ______________________________**_________________
> > > Haskell-Cafe mailing list
> > > Haskell-Cafe at haskell.org
> > > http://www.haskell.org/**mailman/listinfo/haskell-cafe<
> http://www.haskell.org/mailman/listinfo/haskell-cafe>
> > >
>
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-Cafe at haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
> --
> Roman I. Cheplyaka :: http://ro-che.info/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120506/33020d23/attachment.htm>


More information about the Haskell-Cafe mailing list