Re: [Tutor] Nine Language Performance Round-up: Benchmarking Math & File I/O

Magnus Lycka magnus at thinkware.se
Fri Jan 9 13:29:42 EST 2004


> My change yielded close to a 30% speed increase.  I got the idea to
> reduce the amount of assignments from a comment on the article.  What
> other methods could be used to speed this up?

First of all, benchmarks of anything else but programs that
actually perform a time critical function that *you* really
need are rarely relevant. For instance, the graph in the
article shows Java as being much slower than the other
languages (except Python). But it's a sum of different
benchmarks designed and weighed arbitrarily by the author. 
If your application doesn't need trigonometry, but behaves
as the benchmark otherwise (very unlikely), java 1.4 is 
almost as fast as Visual C++, and beats everything else.

For 64 integer operations, Python converts to using slow
unlimited length integers if you use a 32 bit environment. 
Use a 64 bit OS and Python compiled to support that, and 
you'll see a big difference. (Does MS support any of those
platforms yet? Python certainly supports a few.)

Or see what happens if you need to use more than 64 bit
integers, maybe 128 bit integers. (Do the other languages 
support that at all?)

Another option could be to try pyrex. For "real" mathematical
applications, numerical python will often give you a big
advantage, but these benchmarks don't really reflect what
any real application would do.

The thing is, that many of the things you can write up in
for instance Python with Numerical Python in half an hour
would be so time consuming to write in C++, VB or C# that
no benchmark designer would ever try to do that. Instead,
they decide to do a test that is easier to perform, even if
it isn't very meaningful.


-- 
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/  mailto:magnus at thinkware.se



More information about the Tutor mailing list