$tmpl = $mustache->parse($tmplStr); $data = new MustacheData($dataArr); for ($i = 0; $i < $count; $i++) { $out = $mustache->render($tmpl, $data); } $stop = microtime(true); $stopMemory = memory_get_usage(true); printf('%10s %10f %10f %10d %10s' . PHP_EOL, $name, $stop - $start, ($stop - $start) / $count, $count, number_format($stopMemory - $startMemory)); // Compiled $name = 'Compiled'; $startMemory = memory_get_usage(true); $start = microtime(true); $mustache = new Mustache(); $ret = $mustache->compile($tmplStr); for ($i = 0; $i < $count; $i++) { $out = $mustache->execute($ret, $dataArr); } $stop = microtime(true); $stopMemory = memory_get_usage(true); printf('%10s %10f %10f %10d %10s' . PHP_EOL, $name, $stop - $start, ($stop - $start) / $count, $count, number_format($stopMemory - $startMemory)); // Compiled+Data $name = 'Compiled2'; $startMemory = memory_get_usage(true); $start = microtime(true); $tmpl = $mustache->compile($tmplStr); $data = new MustacheData($dataArr); for ($i = 0; $i < $count; $i++) { $out = $mustache->execute($tmpl, $data); } $stop = microtime(true); $stopMemory = memory_get_usage(true);