.NET Floating Point Math BenchMarks

M. Gallant 02/16/2002

The data below shows a simple timing comparison of a double-loop of 100,000,000 type double floating point operations (multiply, square root, addition). The results only compare a very specific type of compute-intensive numeric calculation with no I/O, file or network functionality, and are not meant in any way to suggest overall performance recommendations for the various technologies. They may be useful, however, as a starting point for evaluating scientific-computation based performance which tend to be numeric-compute intensive.

The essential part of the simple loop computation evaluated here is:


  double x1, x2, x3=0;

    for (x1=1; x1<=10000; x1++)
      for(x2=1; x2<=10000; x2++)
        x3 += Math.Sqrt(x1*x2);

Results below are for the following configuration:
Pentium III 848 MHz, 512 Mb RAM, OS: Win2000 SP2

C# (.net Framework SDK) source 6.8 sec
C# (execution versus JIT + execution) source 6.78 vs 7.00 sec
JScript.net (.net Framework SDK) source 6.8 sec
C (VC++6 Standard) source 10.4 sec
Java (Sun j2se v1.3.1) source 6.8 sec
Java (Sun j2se v1.4.0-rc) source 6.8 sec
Java (Sun MS JVM) source 12.6 sec
JScript (WSH host, uncompiled) source 410 sec