<?php
function hallo() {}
function hallo2() {}
function simpleucall($n) { for ($i = 0; $i < $n; $i++) hallo(); }
function simpleudcall($n) { for ($i = 0; $i < $n; $i++) hallo2(); }
function simpleicall($n) { for ($i = 0; $i < $n; $i++) func_num_args(); }
class Foo {
static $a = 0;
public $b = 0;
const TEST = 0;
static function read_static($n) { for ($i = 0; $i < $n; ++$i) $x = self::$a; }
static function write_static($n) { for ($i = 0; $i < $n; ++$i) self::$a = 0; }
static function isset_static($n) { for ($i = 0; $i < $n; ++$i) $x = isset(self::$a); }
static function empty_static($n) { for ($i = 0; $i < $n; ++$i) $x = empty(self::$a); }
static function f() {}
static function call_static($n) { for ($i = 0; $i < $n; ++$i) self::f(); }
function read_prop($n) { for ($i = 0; $i < $n; ++$i) $x = $this->b; }
function write_prop($n) { for ($i = 0; $i < $n; ++$i) $this->b = 0; }
function assign_add_prop($n) { for ($i = 0; $i < $n; ++$i) $this->b += 2; }
function pre_inc_prop($n) { for ($i = 0; $i < $n; ++$i) ++$this->b; }
function pre_dec_prop($n) { for ($i = 0; $i < $n; ++$i) --$this->b; }
function post_inc_prop($n) { for ($i = 0; $i < $n; ++$i) $this->b++; }
function post_dec_prop($n) { for ($i = 0; $i < $n; ++$i) $this->b--; }
function isset_prop($n) { for ($i = 0; $i < $n; ++$i) $x = isset($this->b); }
function empty_prop($n) { for ($i = 0; $i < $n; ++$i) $x = empty($this->b); }
function g() {}
function call($n) { for ($i = 0; $i < $n; ++$i) $this->g(); }
function read_const($n) { for ($i = 0; $i < $n; ++$i) $x = $this::TEST; }
}
function read_static($n){ for ($i = 0; $i < $n; ++$i) $x = Foo::$a; }
function write_static($n) { for ($i = 0; $i < $n; ++$i) Foo::$a = 0; }
function isset_static($n) { for ($i = 0; $i < $n; ++$i) $x = isset(Foo::$a); }
function empty_static($n) { for ($i = 0; $i < $n; ++$i) $x = empty(Foo::$a); }
function call_static($n) { for ($i = 0; $i < $n; ++$i) Foo::f(); }
function create_object($n) { for ($i = 0; $i < $n; ++$i) $x = new Foo(); }
define('TEST', null);
function read_const($n) { for ($i = 0; $i < $n; ++$i) $x = TEST; }
function read_auto_global($n) { for ($i = 0; $i < $n; ++$i) $x = $_GET; }
$g_var = 0;
function read_global_var($n) { for ($i = 0; $i < $n; ++$i) $x = $GLOBALS['g_var']; }
function read_hash($n) { $hash = array('test' => 0); for ($i = 0; $i < $n; ++$i) $x = $hash['test'];}
function read_str_offset($n) { $str = "test"; for ($i = 0; $i < $n; ++$i) $x = $str[1]; }
function issetor($n) { $val = array(0,1,2,3,4,5,6,7,8,9); for ($i = 0; $i < $n; ++$i) $x = $val ?: null; }
function issetor2($n) { $f = false; $j = 0; for ($i = 0; $i < $n; ++$i) $x = $f ?: $j + 1; }
function ternary($n) { $val = array(0,1,2,3,4,5,6,7,8,9); $f = false; for ($i = 0; $i < $n; ++$i) $x = $f ? null : $val; }
function ternary2($n) { $f = false; $j = 0; for ($i = 0; $i < $n; ++$i) $x = $f ? $f : $j + 1; }
/*****/
function getmicrotime() { $t = gettimeofday(); return ($t['sec'] + $t['usec'] / 1000000);}
const N = 50000;
simpleucall(N);
simpleudcall(N);
simpleicall(N);
Foo::write_static(N);
Foo::isset_static(N);
Foo::empty_static(N);
read_static(N);
write_static(N);
isset_static(N);
empty_static(N);
Foo::call_static(N);
call_static(N);
$x = new Foo();
$x->read_prop(N);
$x->write_prop(N);
$x->assign_add_prop(N);
$x->pre_inc_prop(N);
$x->pre_dec_prop(N);
$x->post_inc_prop(N);
$x->post_dec_prop(N);
$x->isset_prop(N);
$x->empty_prop(N);
$x->call(N);
$x->read_const(N);
create_object(N);
read_const(N);
read_auto_global(N);
read_global_var(N);
read_hash(N);
read_str_offset(N);
issetor(N);
issetor2(N);
ternary(N);
ternary2(N);
- Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
preferences:
258.04 ms | 404 KiB | 407 Q