diff options
| author | Dmitry Stogov <dmitry@php.net> | 2010-07-16 11:44:30 +0000 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@php.net> | 2010-07-16 11:44:30 +0000 |
| commit | 8aad91d14a0d213b1eb6fc1c3160f05c1faee228 (patch) | |
| tree | 4a48014ac1f07f34d5c6d879a4ed958e686af927 /Zend/micro_bench.php | |
| parent | 7043949c892e8b99a51f3e105f17ae133668b007 (diff) | |
| download | php-git-8aad91d14a0d213b1eb6fc1c3160f05c1faee228.tar.gz | |
Simplified string offset reading
Diffstat (limited to 'Zend/micro_bench.php')
| -rw-r--r-- | Zend/micro_bench.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Zend/micro_bench.php b/Zend/micro_bench.php index b67bfcda9a..87a1b158c2 100644 --- a/Zend/micro_bench.php +++ b/Zend/micro_bench.php @@ -188,6 +188,20 @@ function read_global_var($n) { } } +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 empty_loop($n) { @@ -300,4 +314,8 @@ read_auto_global(N); $t = end_test($t, '$x = $_GET', $overhead); read_global_var(N); $t = end_test($t, '$x = $GLOBALS[\'v\']', $overhead); +read_hash(N); +$t = end_test($t, '$x = $hash[\'v\']', $overhead); +read_str_offset(N); +$t = end_test($t, '$x = $str[0]', $overhead); total($t0, "Total"); |
