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

Isaac Gouy igouy2 at yahoo.com
Mon May 21 18:15:32 CEST 2012


> From: Richard O'Keefe <ok at cs.otago.ac.nz>
> Sent: Sunday, May 20, 2012 3:41 PM

> On 19/05/2012, at 5:51 AM, Isaac Gouy wrote:
>>> In the 'tsort' case, it turns out that the Java and Smalltalk
>>> versions are I/O bound with over 90% of the time spent just
>>> reading the data.
>>
>> My guess is that they could be written to do better than that - but
> it's
>> idiotic of me to say so without understanding the specifics, please
>> forgive me ;-)
>
> Actually, I/O bound is *good*.

Why would that be good or bad?

I suppose you're just suggesting that, in this case, the performance characteristics of the Java and Smalltalk programs are similar to the C program; but, for whatever reason, you're leaving us guessing about the timings for those other programs.


-snip-
>> Of course, to some degree, user defined hash functions remedy that specific problem.
>
> While creating other, and perhaps worse, ones.
>
> For example, in the Smalltalk code, if you use a Dictionary of Strings,
> you're getting Robert Jenkin's hash function in optimised C.  If you
> supply your own, you're getting a very probably worse hash function
> and it's going to run rather slower.  And above all, the stuff you are
> benchmarking is no longer code that people are actually likely to write.

I think you're being a touch quarrelsome :-)

Do *all* Smalltalk language implementations provide that same hash function in optimised C?

Have Smalltalk language implementations *always* provided that same hash function in optimised C?

How might that hash function be used when the (not necessarily Smalltalk) language implementation does not provide it?

Have you researched what code people are actually likely to write, or are you just speculating? ;-)



-snip-
>>  But we're still going to ask - Will my program be faster if I write it 
>>  in language X? - and we're still going to wish for a simpler answer
>> than - It depends how you write it!
> 
> Here's another little example.  I had a use for the Singular Value 
> Decomposition in a Java program.  Should I use pure Java or native C?
> 
> Pure Java taken straight off the CD-ROM that came with a large
> book of numerical algorithms in Java:   T seconds.
> 
> After noticing that the code was just warmed over Fortran, and was
> varying the leftmost subscript fastest (which is good for Fortran,
> bad for most other languages) and swapping all the matrix dimensions: T/2 
> seconds.
> 
> After rewriting in C:  T/4 seconds.
> 
> After rewriting the C code to call the appropriate BLAS
> and thereby using tuned code for the hardware, T/7 seconds.
> 
> Since this was going to take hundreds of seconds per run, the answer was easy.

Maybe the more interesting question was - Should I use a scripting language + BLAS.


> "It depends" is the second best answer we can get.
> The best answer is one that says _what_ it depends on.

That may be the best answer to some other question - but for the stated question I think were looking for a Yes or a No :-)



More information about the Haskell-Cafe mailing list