From fd86c7a45f9d35e46e3164131d9ee9ee2ecc04b2 Mon Sep 17 00:00:00 2001 From: zYne Date: Fri, 31 Aug 2007 23:20:02 +0000 Subject: [PATCH] --- benchmark/mixin.php | 69 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 benchmark/mixin.php diff --git a/benchmark/mixin.php b/benchmark/mixin.php new file mode 100644 index 000000000..a5a0b3664 --- /dev/null +++ b/benchmark/mixin.php @@ -0,0 +1,69 @@ +getFileName()); + + $start = $refl->getStartLine(); + $end = $refl->getEndLine(); + + $ret = array_slice($lines, $start, ($end - $start)); + + $code = trim(trim(implode(' ', $ret)), '{}'); + + $_map[$tpl . $method] = $code; + } else { + $code = $_map[$tpl . $method]; + } + eval($code); +} +function someCode() { + $a = 10; +} +class Template +{ + public function exec() + { + $a = 10; + } +} +print "
MIXIN BENCHMARK \n";
+
+$timepoint = microtime(true);
+
+$i = 500;
+
+while ($i--) {
+    mixin('someCode');
+}
+
+print 'EXECUTED 500 CODE BLOCKS : ' . (microtime(true) - $timepoint) . "\n";
+
+
+$timepoint = microtime(true);
+
+$i = 500;
+
+while ($i--) {
+    someCode();
+}
+
+print 'EXECUTED 500 DIRECT FUNCTION CALLS : ' . (microtime(true) - $timepoint) . "\n";
+
+$timepoint = microtime(true);
+
+$i = 500;
+
+while ($i--) {
+    eval('$a = 10;');
+}
+
+print 'EXECUTED 500 DIRECT EVAL CALLS : ' . (microtime(true) - $timepoint) . "\n";