why () is () and [] is [] work in other way?
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Thu Apr 26 22:47:43 EDT 2012
On Thu, 26 Apr 2012 17:16:10 -0700, Adam Skutt wrote:
> On Apr 26, 7:33 pm, Steven D'Aprano <steve
> +comp.lang.pyt... at pearwood.info> wrote:
>> On Thu, 26 Apr 2012 12:22:55 -0700, Adam Skutt wrote:
>> > I often wonder what the world would be like if Python, C#, and Java
>> > embraced value types more, and had better support for pure functions.
>>
>> They would be slower, require more memory,
>
> Funny, Haskell frequently beats C in both categories.
We've both been guilty of this, but don't confuse a language
implementation with a language. Haskell and C are languages, which in a
sense are like Platonic ideals: languages specify behaviour and
semantics, but have no costs.
When talking about resource usage, you need to talk about concrete
implementations of concrete tests, not hand-wavy "language X is faster".
And I'm afraid that your claim of Haskell frequently beating C doesn't
stand up to scrutiny.
http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&lang=ghc&lang2=gcc
I'm seeing code generated by the Haskell GHC compiler being 2-4 times
slower than code from the C gcc compiler, and on average using 2-3 times
as much memory (and as much as 7 times).
Feel free to find your own set of benchmarks that show the opposite. I'd
be interested to see under what conditions Haskell might be faster than C.
--
Steven
More information about the Python-list
mailing list