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";