MathGroup Archive 1990

[Date Index] [Thread Index] [Author Index]

Search the Archive

Speeding up Mathematica

  • To: uiucuxc!!mathgroup
  • Subject: Speeding up Mathematica
  • From: uiucuxc!!crm (Charles R. Martin)
  • Date: Wed, 14 Mar 90 15:28:39 EST

Paul, Steve --

I've been following the discussion of compiled functions vs. Mathematica
with great interest.  Some of you may recall I asked related questions
several months ago; here's what I've found out:

(1) It is surprisingly easy to get Mathematica to take a function worked
    out in Mathematica and then generate C.   You all knew that.

(2) Using a sed script or the like, the generated code can be munged into 
    a C program that can run on the end of a pipe; this program can then
    be used to generate values that Mathematica can use.

(3) The net gain in speed by doing this is about a factor of 50,

(This is all stuff that was done by Vick Khera here at Duke.  He's
supposed to be writing a paper on it, but I haven't seen it yet.)

Now, I understand these codes to be heavily numerical, so this speedup
can't be applied to the pattern-matching problem Steve mentions.  That
factor of fifty, though, makes me suspicious that the gains to be gotten
by fancy Mathematica optimizations are never going to give the gains
that can be had by running the function in compiled code.  Worse,
running things at the end of a pipe is not available on all systems
(e.g., the 386, at least with version 1.2) so this technique can't be
directly applied.

There are a number of applications that I would be interested in, mostly
in biological modelling, that this kind of speedup would make all the
difference between a usuable interactive program (a few minutes to an
hour) and imitation batch mode (many hours or overnight.)  A Mathematica
compiler might mean a gain, but what I'd *really* like to see is some
way of building C codes that fit some calling convention, and that can
be linked with or dynamically loaded into Mathematica.  Then I could
build fast numerical methods from known algorithms, optimize them for
greater speed, and call them from Mathematica as primitives.  While
there ae a lot of nice techniques for optimizing Mathematica functions,
most of my users aren't interested in learning the joys of Mathematica
hacking; they want to know what that organelle/cell/chunk of myocardium
is doing.

Being able to call a Crank-Nicholson solver that was *fast* might make a
lot of problems a lot easier for the users I might recommend Mathematica
to.   (Gack what a horrible sentence.)

Charlie Martin (...!mcnc!duke!crm, crm at
NBSR/Box 3709/Duke University Medical Center/Durham, NC 27710

P.S.  Let me know about Mathematica users groups.

  • Prev by Date: Complex I
  • Next by Date: Re: Speeding up Mathematica
  • Previous by thread: Re: Speeding up Mathematica
  • Next by thread: Re: Speeding up Mathematica