Linked by Christopher W. Cowell-Shah on Thu 8th Jan 2004 19:33 UTC
General Development This article discusses a small-scale benchmark test run on nine modern computer languages or variants: Java 1.3.1, Java 1.4.2, C compiled with gcc 3.3.1, Python 2.3.2, Python compiled with Psyco 1.1.1, and the four languages supported by Microsoft's Visual Studio .NET 2003 development environment: Visual Basic, Visual C#, Visual C++, and Visual J#. The benchmark tests arithmetic and trigonometric functions using a variety of data types, and also tests simple file I/O. All tests took place on a Pentium 4-based computer running Windows XP. Update: Delphi version of the benchmark here.
Permalink for comment
To read all comments associated with this story, please click here.
perl test and another test method
by Jimmy on Fri 9th Jan 2004 13:55 UTC

I've sent the auther a perl version that i hacked up during lunch break. I hope he'll post the results along with the others. I "ported" it from the C version, keeping the authors original style of writing (all math in perl/python is FP anyway)

I once did a test of perl vs. python vs. C (as ref. language) by using a small is_prime function, and then setting it off on a given range of primes. I didnt keep the results, but if i remember correct, C would finish quite fast, perl would take it's sweet time, and python was just dog slow (all tests without optimisation, and no precompilation for intepreted languages). I never did a Java port of it (target was a unix platform, and java is not my first choise there), but it would be interesting to see any comparisons. The algorithm is (C syntax ) :

int is_prime(unsigned long x)
{
if(x <= 3)
{
if(x == 1)
return(0); // 1 isnt a "real" prime
else
return(1);
}
else if ( x % 2 == 0)
return(0);
else
{
long ctr = 3;
while(1)
{
if((x % ctr) == 0)
return(0);
else if ((ctr * ctr) > x)
return(1);
ctr+=2;
}
}
}