MathGroup Archive 2001

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

Search the Archive

Re: Lists and speed

  • To: mathgroup at smc.vnet.net
  • Subject: [mg30170] Re: Lists and speed
  • From: Tom Burton <tburton at cts.com>
  • Date: Wed, 1 Aug 2001 02:19:25 -0400 (EDT)
  • References: <9k5qp5$ha6$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hello,

Assuming that differences in hardware are accounted for, then your posted speed ratio of 30 (optimized, compiled code compared to Mathematica) is in line with my experience. When I do care about speed in Mathematica, I can usually cut this ratio to 10 simply with Compile, without rethinking the programming approach. And of course, further drastic improvements are often possible, as documented in this group many times over.

At the other end of the spectrum is my Mathematica prototype for a technical software product. The goals for this prototype are accuracy, robustness, reliability, and transparency to both technical readers and the programmer whose job it is to generate C++ (with the aid of C exported from the prototype for tedious bits).

I don't care about speed in the prototype. The C++ programmer, on the other hand, takes liberties with transparency and robustness (e.g., caching all over the place and assuming rather than verifying reciprocity and conservation of energy) in the name of speed, secure in the knowledge that the QA system (comparing C++ to Mathematica prototype, run daily) will uncover most C++ coding and compiler problems. 

The Mathematica prototype slogs through the QA suite in 5799 seconds. After accounting for hardware differences, the released C++ software cruises through the same suite in 105 seconds. Here the ratio is 55. But, again, I don't care.

You should be able to get within a factor of 10 with minimal effort, but if Mathematica is not slowing you down, don't bother. On the other hand, if you chronically need to get the ratio much below 10, then rather than busting your brain repeatedly in trying to make Mathematica work faster, you might instead learn to use Mathlink, so Mathematica and C can cooperate, the latter doing the stuff that runs too slowly in Mathematica.

Tom Burton

On Tue, 31 Jul 2001 08:37:57 +0000 (UTC), in comp.soft-sys.math.mathematica you wrote:

>Hi,
>
>About a month ago I submitted a question about lists  and received some 
>very useful help (summarised below). However, although my program (a 
>coupled map lattice for population dynamics) now works well with Ted 
>Ersek's modifications, it still takes over 20 minutes (compared to the 
>original 40 minutes) to run.
>A colleague has just coded the same thing in another system, which runs in around 40 _seconds_...is this unusual?
>I was happy to trade-off speed for faster development time compared to 
>Pascal etc, but the difference here seems so huge that I'm concerned that 
>my Mathematica programming is still way-off.
>Any thoughts welcome.
>Thanks
Tom Burton


  • Prev by Date: Re: Any quantum chemists / physicists?
  • Next by Date: Re: SquareFreeQ vs. MoebiusMu
  • Previous by thread: Re: Lists and speed
  • Next by thread: Re: Lists and speed