performance measurements

Each table row shows performance measurements for this Java program with a particular command-line input value N.

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
5000.400.41696514  0% 3% 0% 98%
3,0005.325.3326,632514  1% 1% 1% 100%
5,50017.3217.3326,856514  0% 1% 1% 100%

Read the ↓ make, command line, and program output logs to see how this program was run.

Read spectral-norm benchmark to see what this program should do.


java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) Server VM (build 25.45-b02, mixed mode)

 spectral-norm Java program source code

/* The Computer Language Benchmarks Game
 contributed by Java novice Jarkko Miettinen
 modified ~3 lines of the original C#-version 
 by Isaac Gouy
import java.text.DecimalFormat;
import java.text.NumberFormat; 

public class spectralnorm
   private static final NumberFormat formatter = new DecimalFormat("#.000000000");
   public static void main(String[] args) {
      int n = 100;
      if (args.length > 0) n = Integer.parseInt(args[0]);
      System.out.println(formatter.format(new spectralnorm().Approximate(n)));
   private final double Approximate(int n) {
      // create unit vector
      double[] u = new double[n];
      for (int i=0; i<n; i++) u[i] =  1;
      // 20 steps of the power method
      double[] v = new double[n];
      for (int i=0; i<n; i++) v[i] = 0;
      for (int i=0; i<10; i++) {
      // B=AtA         A multiplied by A transposed
      // v.Bv /(v.v)   eigenvalue of v
      double vBv = 0, vv = 0;
      for (int i=0; i<n; i++) {
         vBv += u[i]*v[i];
         vv  += v[i]*v[i];
      return Math.sqrt(vBv/vv);
   /* return element i,j of infinite matrix A */
   private final double A(int i, int j){
      return 1.0/((i+j)*(i+j+1)/2 +i+1);
   /* multiply vector v by matrix A */
   private final void MultiplyAv(int n, double[] v, double[] Av){
      for (int i=0; i<n; i++){
         Av[i] = 0;
         for (int j=0; j<n; j++) Av[i] += A(i,j)*v[j];
   /* multiply vector v by matrix A transposed */
   private final void MultiplyAtv(int n, double[] v, double[] Atv){
      for (int i=0;i<n;i++){
         Atv[i] = 0;
         for (int j=0; j<n; j++) Atv[i] += A(j,i)*v[j];
   /* multiply vector v by matrix A and then by matrix A transposed */
   private final void MultiplyAtAv(int n, double[] v, double[] AtAv){
      double[] u = new double[n];

 make, command-line, and program output logs

Tue, 19 May 2015 04:12:07 GMT

mv: ‘’ and ‘’ are the same file
/home/dunham/benchmarksgame/nanobench/makefiles/u32.programs.Makefile:308: recipe for target 'spectralnorm.java_run' failed
make: [spectralnorm.java_run] Error 1 (ignored)
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
0.72s to complete and log all make actions

/usr/local/src/jdk1.8.0_45/bin/java  -server -XX:+TieredCompilation -XX:+AggressiveOpts spectralnorm 5500


Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 

Revised BSD license

  Home   Conclusions   License   Play