summaryrefslogtreecommitdiff
path: root/Zend/micro_bench.php
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2010-07-08 14:05:11 +0000
committerDmitry Stogov <dmitry@php.net>2010-07-08 14:05:11 +0000
commitf0c8366a9e8acd832b6d433035d162218f8db1ec (patch)
tree8187bb3ba4addf708a7845b408db6bdc0fe7e488 /Zend/micro_bench.php
parenteea8fc6122d80179adbfd9f0a234d9cb23c7984e (diff)
downloadphp-git-f0c8366a9e8acd832b6d433035d162218f8db1ec.tar.gz
- use interned strings for auto globals
- $GLOBALS became a JIT autoglobal, so it's initialized only if used (this may affect opcode caches)
Diffstat (limited to 'Zend/micro_bench.php')
-rw-r--r--Zend/micro_bench.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/Zend/micro_bench.php b/Zend/micro_bench.php
index 0d705e942b..b67bfcda9a 100644
--- a/Zend/micro_bench.php
+++ b/Zend/micro_bench.php
@@ -174,6 +174,20 @@ function read_const($n) {
}
}
+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 empty_loop($n) {
@@ -282,4 +296,8 @@ create_object(N);
$t = end_test($t, 'new Foo()', $overhead);
read_const(N);
$t = end_test($t, '$x = TEST', $overhead);
+read_auto_global(N);
+$t = end_test($t, '$x = $_GET', $overhead);
+read_global_var(N);
+$t = end_test($t, '$x = $GLOBALS[\'v\']', $overhead);
total($t0, "Total");