[Haskell-cafe] Implementing Mathematica

Andrew Coppin andrewcoppin at btinternet.com
Thu May 31 15:56:47 EDT 2007


Jon Harrop wrote:
> If you write a simple, numerically-intensive program that runs in the 
> Mathematica rewriter then its performance is about 100-1,000x slower than 
> that of a native-code compiled language like Haskell. Mathematica is often 
> 30x slower than interpreted OCaml bytecode.
>   

Is this before or after compiling the Mathematica code?

> Incidentally, when I try to recompile with optimizations turned on, GHC 
> refuses to work:
>
> $ ghc htrace.hs -o htrace
> $ ghc -O2 htrace.hs -o htrace
> compilation IS NOT required
>
> I must delete the target or edit the source to get it to recompile. I assume 
> this is a known bug?
>   

This one surprised me... I'm pretty sure I tried recompiling with -O2 
and it recompiled everything. Maybe I imagined it?

> Right, but that is just calling an internal function that is written in C. 
> Provided you only ever call a few library functions, performance will be 
> excellent in Mathematica. But when you cannot phrase your program in terms of 
> the built-in library functions, performance is terrible and this is when 
> everyone reaches for a more efficient tool.
>   

I don't know, I thought one of the big advantages of Mathematica was 
supposed to be that it can transform problems into the most efficiently 
solvable form, select between multiple algorithms, etc.

> To me, performance is way down on the list of things that make Mathematica 
> great. Integrated graphics is probably the main benefit. I mostly use MMA as 
> a glorified graph plotter.
>   

And I mostly use it to do insane things like give me parametric 
solutions to giant polynomials and so forth... ;-)



More information about the Haskell-Cafe mailing list