Beispiel #1
0
 private function _test_to_string5digits()
 {
     $digits = 5;
     $bench = new Bench();
     $this->random_usleep();
     $time = $bench->to_string($digits);
     self::assertRegExp(sprintf($this->result_format_regex, $digits), $time);
 }
 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();
 }
Beispiel #3
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 />';
}