Пример #1
0
$t0 = $t = start_test();
simple();
$t = end_test($t, "simple");
simplecall();
$t = end_test($t, "simplecall");
simpleucall();
$t = end_test($t, "simpleucall");
simpleudcall();
$t = end_test($t, "simpleudcall");
mandel();
$t = end_test($t, "mandel");
mandel2();
$t = end_test($t, "mandel2");
ackermann(7);
$t = end_test($t, "ackermann(7)");
ary(50000);
$t = end_test($t, "ary(50000)");
ary2(50000);
$t = end_test($t, "ary2(50000)");
ary3(2000);
$t = end_test($t, "ary3(2000)");
fibo(30);
$t = end_test($t, "fibo(30)");
hash1(50000);
$t = end_test($t, "hash1(50000)");
hash2(500);
$t = end_test($t, "hash2(500)");
heapsort(20000);
$t = end_test($t, "heapsort(20000)");
matrix(20);
$t = end_test($t, "matrix(20)");
Пример #2
0
 /**
  * @dataProvider various
  */
 public function ary()
 {
     $test = ['x' => ['xx' => 'xxx']];
     $ary = new Ary($test);
     $this->assertEquals(ary($test)->x['xx'], $ary->ary('x')->xx);
     $this->assertEquals(ary(ary($test)->x['xx']), $ary->ary('x')->ary('xx'));
 }
Пример #3
0
function main_function()
{
    for ($i = 0; $i < 100; ++$i) {
        ackermann(4);
        ary(50000);
        ary2(50000);
        ary3(100);
        fibo(23);
        hash1(10000);
        hash2(200);
        heapsort(2000);
        matrix(3);
        nestedloop(8);
        sieve(5);
        strcat(80000);
        binary_trees(7);
        fannkuch(6);
    }
}
Пример #4
0
    return $t['sec'] + $t['usec'] / 1000000;
}
function start_test()
{
    ob_start();
    return getmicrotime();
}
function end_test($start, $name)
{
    global $total;
    $end = getmicrotime();
    ob_end_clean();
    $total += $end - $start;
    $num = number_format($end - $start, 3);
    $pad = str_repeat(" ", 24 - strlen($name) - strlen($num));
    echo $name . $pad . $num . "\n";
    ob_start();
    return getmicrotime();
}
function total()
{
    global $total;
    $pad = str_repeat("-", 24);
    echo $pad . "\n";
    $num = number_format($total, 3);
    $pad = str_repeat(" ", 24 - strlen("Total") - strlen($num));
    echo "Total" . $pad . $num . "\n";
}
$t0 = $t = start_test();
ary(500000, 2);
$t = end_test($t, "ary(50000)");
Пример #5
0
<?php 
function ary($n)
{
    for ($i = 0; $i < $n; $i++) {
        $X[$i] = $i;
    }
    for ($i = $n - 1; $i >= 0; $i--) {
        $Y[$i] = $X[$i];
    }
    $last = $n - 1;
    print "{$Y[$last]}\n";
}
$n = $argc == 2 ? $argv[1] : 100000;
ary($n);
Пример #6
0
<?php

function ary($n)
{
    for ($i = 0; $i < $n; $i++) {
        $X[$i] = $i;
    }
    for ($i = $n - 1; $i >= 0; $i--) {
        $Y[$i] = $X[$i];
    }
    $last = $n - 1;
    print "{$Y[$last]}\n";
}
ary(5);
Пример #7
0
function main_function()
{
    ackermann(2);
    ary(500);
    ary2(500);
    ary3(5);
    fibo(13);
    hash1(100);
    hash2(20);
    heapsort(200);
    matrix(3);
    nestedloop(3);
    sieve(1);
    strcat(80);
    binary_trees(3);
    fannkuch(6);
}
Пример #8
0
 static function ary()
 {
     Timing::Start("ary.php");
     ary(100000);
     Timing::Stop();
     Timing::Start("ary2.php");
     ary2(100000);
     Timing::Stop();
     Timing::Start("ary3.php");
     ary3(1000);
     Timing::Stop();
 }