performance measurements

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

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
5000.660.6676,212398  2% 94% 6% 3%
3,00016.6416.6574,360398  1% 1% 0% 100%
5,50055.4255.4476,352398  1% 1% 100% 0%

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

HipHop VM 3.4.1 (rel)
Compiler: tags/HHVM-3.4.1-0-g5b66f110ebe9bafccecd8946d391b0f895dc107a
Repo schema: bf1db525c412a46f0b4b68c5a5bed52f64183008
Extension API: 20140829

 spectral-norm Hack #2 program source code

<?hh 
/* The Computer Language Benchmarks Game
http://benchmarksgame.alioth.debian.org/

contributed by Isaac Gouy
modified by anon
PHP as HHVM/Hack by Isaac Gouy
*/


function A(&$i, &$j){
   return 1.0 / ( ( ( ($i+$j) * ($i+$j+1) ) >> 1 ) + $i + 1 );
}

function Av(&$n,&$v){
   global $_tpl;
   $Av = $_tpl;
   for ($i = 0; $i < $n; ++$i) {
      $sum = 0.0;
      foreach($v as $j=>$v_j) {
         $sum += A($i,$j) * $v_j;
      }
      $Av[$i] = $sum;
   }
   return $Av;
}

function Atv(&$n,&$v){
   global $_tpl;
   $Atv = $_tpl;
   for($i = 0; $i < $n; ++$i) {
      $sum = 0.0;
      foreach($v as $j=>$v_j) {
         $sum += A($j,$i) * $v_j;
      }
      $Atv[$i] = $sum;
   }
   return $Atv;
}

function AtAv(&$n,&$v){
   $tmp = Av($n,$v);
   return Atv($n, $tmp);
}

$n = intval(($argc == 2) ? $argv[1] : 1);
$u = array_fill(0, $n, 1.0);
$_tpl = array_fill(0, $n, 0.0);

for ($i=0; $i<10; $i++){
   $v = AtAv($n,$u);
   $u = AtAv($n,$v);
}

$vBv = 0.0;
$vv = 0.0;
$i = 0;
foreach($v as $val) {
   $vBv += $u[$i]*$val;
   $vv += $val*$val;
   ++$i;
}
printf("%0.9f\n", sqrt($vBv/$vv));

 make, command-line, and program output logs

Fri, 19 Dec 2014 22:50:51 GMT

MAKE:
/usr/bin/hh_client
No errors!
0.02s to complete and log all make actions

COMMAND LINE:
/usr/bin/hhvm  spectralnorm.hack-2.hack 5500

PROGRAM OUTPUT:
1.274224153

Revised BSD license

  Home   Conclusions   License   Play