performance measurements

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

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
5000.270.27280457  4% 14% 0% 100%
3,0006.926.9317,672457  1% 0% 1% 100%
5,50023.1023.1135,260457  1% 1% 0% 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.

 notes

Dart VM version: 1.5.1 (Tue Jun 24 04:16:47 2014) on "linux_ia32"

 spectral-norm Dart program source code

// The Computer Language Benchmarks Game
// http://benchmarksgame.alioth.debian.org/
//
// contributed by Jos Hirth
// based on the JavaScript version by Ian Osgood with modifications by Isaac Gouy

import 'dart:math' as Math;
import 'dart:typed_data';

double A(int i, int j) {
  int div = ((i + j) * (i + j + 1) >> 1) + i + 1;
  return 1.0 / div;
}

void Au(Float64List u, Float64List w) {
  int len = u.length;
  for (int i = 0; i < len; ++i) {
    double t = 0.0;
    for (int j = 0; j < len; ++j) {
      t += A(i, j) * u[j];
    }
    w[i] = t;
  }
}

void Atu(Float64List w, Float64List v) {
  int len = w.length;
  for (int i = 0; i < len; ++i) {
    double t = 0.0;
    for (int j = 0; j < len; ++j) {
      t += A(j, i) * w[j];
    }
    v[i] = t;
  }
}

void AtAu(Float64List u, Float64List v, Float64List w) {
  Au(u, w);
  Atu(w, v);
}

double spectralNorm(n) {
  var u = new Float64List(n)..fillRange(0, n, 1.0),
      v = new Float64List(n),
      w = new Float64List(n),
      vv = 0.0,
      vBv = 0.0;

  for (int i = 0; i < 10; ++i) {
    AtAu(u, v, w);
    AtAu(v, u, w);
  }
  for (int i = 0; i < n; ++i) {
    vBv += u[i] * v[i];
    vv  += v[i] * v[i];
  }
  return Math.sqrt(vBv / vv);
}

void main(args) {
  int n = args.length > 0 ? int.parse(args[0]) : 100;
  print(spectralNorm(n).toStringAsFixed(9));
}

 make, command-line, and program output logs

Fri, 27 Jun 2014 19:39:30 GMT

COMMAND LINE:
/usr/local/src/dart-sdk/bin/dart  spectralnorm.dart 5500

PROGRAM OUTPUT:
1.274224153

Revised BSD license

  Home   Conclusions   License   Play