D component programming is a joke (Was: Re: Component programming)
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Wed Jul 31 17:07:15 PDT 2013
On 7/31/13 4:17 PM, bearophile wrote:
> Walter Bright:
>
>> Ironically, the component program from the article I wrote:
>> ...
>> is 2x faster than the Haskell version:
>
> Benchmarking code written in two different languages is tricky, there
> are so many sources of mistakes, even if you know well both languages.
I measured the timings. It was in a discussion between Walter, myself,
and a common friend. That friend said Haskell will do a lot better on
the same task. I measured by piping 1,000,000 lines of real log data
through the tested programs.
His first version was:
import Data.List main = interact $ unlines . sort . lines
This took 51 seconds. The friend got a bit miffed complaining I only
measured to ridicule his code (but this is hardly the first time hard
numbers offended someone) and went to ask on Haskell fora on how to make
the code faster. His second version was:
import Data.List import qualified Data.ByteString.Lazy.Char8 as L
main = L.interact $ L.unlines . sort . L.lines
This version took 7 seconds. A debug version of the D code took 3 seconds.
> But I accept your timing.
This is most gracious considering the crass statement with which you opened.
> And I say that it's good :-) We should aim to
> be better than the Intel Labs Haskell Research Compiler (HRC) :-)
Is that a lot better than ghc?
Andrei
More information about the Digitalmars-d
mailing list