MathGroup Archive 1998

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

Search the Archive

Mathlink slowdown with Win-NT



Hello,

has the MathLink interface for Mathematica 3.0.1 become much slower than
the one for Mathematica 2?


I have two flavours of the MathLink library: the code is exactly the 
same, one is Mprepped and compiled and linked with the  version 2
development tools, the other with the version 3 tools. The exe-files
are for "32-bit flat" in both cases (DOS-4GW in the case of the version
2 library).

I have one computation intensive function, which I have implemented as
MathLinked program. When called, this "construction step" function 
receives a lot of data across MathLink and then it does its
computation.  The computed result is kept in the MathLink library, only
a handle  (an integer number to reference the result) is returned to
Mathematica.


Then there is another MathLink function called MLI[x,y,handle], which
computes a z-value for given x and y and handle. This function  also is
somewhat computation intensive, but it only receives few data,  when
called - contrary to the construction step.

When I call 

   Plot3D[MLI[x,y,handle],{x,xMin,xMax},{y,yMin,yMax},PlotPoints->50]
     
this takes an awful lot of time on my new Pentium-II based Win-NT4.0
(Sp3) computer running Mathematica 3.0.1. Although this computer is
more than 10 times faster than my old Win-3.1 PC running Mathematica
2.2.3, the Plot3D on the new machine takes 78 seconds compared to 41
seconds on the old computer. (The difference is not the graphics card:
Plot3D for a Mathematica-defined function of 2 parameters on the new
computer is muchg faster than on the old one.)

On the other hand, the construction step on the new PC is much faster
than on the old one, as one might expect.

To find out, what is going on, i activated WinNT's TaskManager. When
looking at processor usage, I found out, that the processor wastes most
of its time in the idle process, when I am waiting for my Plot3D! The
processor-time "meters" of the kernel and of the MathLinked program
almost eat up nothing! Processor usage is around 2-3%. Only short,
before the plot is actually plottet, there is a short burst on 100% (I
guess, when the front end takes over control to render the plot).

My preliminary conclusion is, that the MathLink interface has become
slower than before, the "netto" code seems to work as expected. This
however, may be due to non optimum settings in the Win-NT  environment,
rather in the MathLink mechanism itself.

Any idea how to further investigate the slow-down or how to overcome it
is very wellcome. Thanks in advance!

Dipl-Math. Adalbert Hanszen <hsse@amath01.amath.zeiss.de>




  • Prev by Date: Re: How draw 3D Arrows?
  • Next by Date: Re: replacement rules in packages
  • Prev by thread: RE: replacement rules in packages
  • Next by thread: New version of Leibniz available