public function execute(HTTPRequestCustom $request)
 {
     $this->init();
     $this->test = str_repeat($this->test, 1);
     $bench_non_cached = new Bench();
     $bench_non_cached->start();
     $this->run_non_cached_parsing();
     $bench_non_cached->stop();
     $bench_cached = new Bench();
     $bench_cached->start();
     $this->run_cached_parsing();
     $bench_cached->stop();
     $this->view->put_all(array('RESULT' => StringVars::replace_vars($this->lang['string_template.result'], array('non_cached_time' => $bench_non_cached->to_string(5), 'cached_time' => $bench_cached->to_string(5), 'string_length' => strlen($this->test)))));
     return $this->generate_response();
 }
예제 #2
0
<?php

// Description: Serialize scalar int
require_once 'bench.php';
$b = new Bench('serialize-scalar-int');
$var = 1;
for ($i = 0; $i < 40; $i++) {
    $b->start();
    for ($j = 0; $j < 3500000; $j++) {
        $ser = igbinary_serialize($var);
    }
    $b->stop($j);
    $b->write();
}
예제 #3
0
 /**
  * Reset timer.
  *
  * @return void;
  */
 public static function reset()
 {
     self::$marks = array();
     self::$start = null;
     self::$stop = null;
 }
예제 #4
0
function bench_string($string_size, $string_iteration)
{
    echo '<h1>String</h1>';
    $string = '';
    for ($i = 0; $i < $string_size; $i++) {
        $string .= '.';
    }
    $bench = new Bench();
    $bench->start();
    for ($i = 0; $i < $string_iteration; $i++) {
        string_by_ref($string);
    }
    $bench->stop();
    echo 'Ref: ' . $bench->to_string() . '<hr />';
    $bench = new Bench();
    $bench->start();
    for ($i = 0; $i < $string_iteration; $i++) {
        string_by_cp($string);
    }
    $bench->stop();
    echo 'Copy: ' . $bench->to_string() . '<hr />';
}