Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

Re: Mathematica vs. Executable code

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15956] Re: Mathematica vs. Executable code
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Wed, 17 Feb 1999 23:34:15 -0500
  • Organization: Universitaet Leipzig
  • References: <7a29hc$1pa@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Ted,

my experience is that the time relation 

t_Mathematica approx 10 t_MathCompile approx 100 t_MachineCode

even if Mathematica get's faster in is execution the MachineCode
can be speeded up as well and it will never beat a factor of 100. 
The problem is that a lot of speed in the MathLink comunication 
depends on the overhead.  If you have a single simple function in
your C-code (one double argument, and one double return) the
comunication will eat up the speed gain compared with the internal
evaluation. But if the function performs several hundred operations
the speed up is enorm. More over the next Mathematica version may
be also have a faster MathLink comunication.

When I tested Mathematica 3.0 the MathLink protocol of the
beta version was extrem slow and I recoded some of my C-functions.
The final version was a bit faster and in the 3.0.1 version the
MathLink communication was faster than ever before.

The problem depends not only on the Mathematica
version but also heavy on the problem and the coding.

The next problem is that typical a mixture of C and Mathematica
is used during the transfer. If one has to transfer a matrix
it is faster to transfer a one dimensional array and leave the
partition into rows to Mathematica. The same apply to other
structures say you have to send some thundred polygons in a list
to Mathematica. It is faster to transfer a list of point lists and
map the Polygon[] head inside Matheamtica. The same apply in the 
transfer from Mathematica to the machine program. 

Finaly I think your question is a bit to early. There may be some
beta-testers that have a Mathematica 3+x version, but no beta tester
will post something about Mathematica 3+x into a news group.
In some weeks, month or years when every body has Mathematica 3+x
there will be a better response.

At least I have a Coulomb wave function in MathLink *and* Mathematica,
with the same algorithm. Ask me again when Mathematica 3+x has arrived
me.

Regards
  Jens


"Ersek, Ted R" wrote:
> 
> A lot of people have the idea that a Mathematica program is typically
> very slow compared to a compiled program written in C (or a similar
> language) to do the same thing.  I know Mathematica will improve a lot
> in this regard once the next version (with packed arrays) comes out.
> 
> I hope someone will demonstrate how the next version of Mathematica
> compares with compiled programs.  I would do it myself, but I have
> little programming experience with anything but Mathematica.  One could
> take some very number intensive algorithms and implement them using
> Mathematica and compiled programs.  Maybe people at WRI could write the
> Mathematica implementations, so we know they're efficient.  The
> comparison would only look at the performance using machine precision
> arithmetic, and would compare speed, memory requirements, and program
> complexity using the two approaches.
> 
> In my mind Mathematica is the way to go for very high level programming,
> symbolic algebra, arbitrary precision arithmetic, exact arithmetic, and
> graphics.  Mathematica also has the advantage in program complexity,
> program portability and robust numerics (e.g.  Exp[2000.0] doesn't give
> an overflow).  What about speed and memory requirements once we get the
> next version?  Maybe Mathematica will still come up short in that area,
> but by how much?
> 
> Regards,
> Ted Ersek


  • Prev by Date: Re: Problem with Fonts
  • Next by Date: Re: Dont Understand
  • Previous by thread: Mathematica vs. Executable code
  • Next by thread: RE: Mathematica vs. Executable code