summaryrefslogtreecommitdiff
path: root/Zend/micro_bench.php
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/micro_bench.php')
-rw-r--r--Zend/micro_bench.php318
1 files changed, 159 insertions, 159 deletions
diff --git a/Zend/micro_bench.php b/Zend/micro_bench.php
index 42f1110c88..96ced487e1 100644
--- a/Zend/micro_bench.php
+++ b/Zend/micro_bench.php
@@ -22,220 +22,220 @@ function simpleicall($n) {
}
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;
- }
- }
+ 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;
- }
+ for ($i = 0; $i < $n; ++$i) {
+ $x = Foo::$a;
+ }
}
function write_static($n) {
- for ($i = 0; $i < $n; ++$i) {
- Foo::$a = 0;
- }
+ for ($i = 0; $i < $n; ++$i) {
+ Foo::$a = 0;
+ }
}
function isset_static($n) {
- for ($i = 0; $i < $n; ++$i) {
- $x = isset(Foo::$a);
- }
+ for ($i = 0; $i < $n; ++$i) {
+ $x = isset(Foo::$a);
+ }
}
function empty_static($n) {
- for ($i = 0; $i < $n; ++$i) {
- $x = empty(Foo::$a);
- }
+ for ($i = 0; $i < $n; ++$i) {
+ $x = empty(Foo::$a);
+ }
}
function call_static($n) {
- for ($i = 0; $i < $n; ++$i) {
- Foo::f();
- }
+ for ($i = 0; $i < $n; ++$i) {
+ Foo::f();
+ }
}
function create_object($n) {
- for ($i = 0; $i < $n; ++$i) {
- $x = new Foo();
- }
+ for ($i = 0; $i < $n; ++$i) {
+ $x = new Foo();
+ }
}
define('TEST', null);
function read_const($n) {
- for ($i = 0; $i < $n; ++$i) {
- $x = TEST;
- }
+ for ($i = 0; $i < $n; ++$i) {
+ $x = TEST;
+ }
}
function read_auto_global($n) {
- for ($i = 0; $i < $n; ++$i) {
- $x = $_GET;
- }
+ 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'];
- }
+ 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'];
- }
+ $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];
- }
+ $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;
- }
+ $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;
- }
+ $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;
- }
+ $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;
- }
+ $f = false; $j = 0;
+ for ($i = 0; $i < $n; ++$i) {
+ $x = $f ? $f : $j + 1;
+ }
}
/*****/
function empty_loop($n) {
- for ($i = 0; $i < $n; ++$i) {
- }
+ for ($i = 0; $i < $n; ++$i) {
+ }
}
function gethrtime()