$name = 'Normal'; $startMemory = memory_get_usage(true); $start = microtime(true); $mustache = new Mustache(); for ($i = 0; $i < $count; $i++) { $out = $mustache->render($tmplStr, $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)); // Parsed $name = 'Parsed'; $startMemory = memory_get_usage(true); $start = microtime(true); $mustache = new Mustache(); $ret = $mustache->parse($tmplStr); for ($i = 0; $i < $count; $i++) { $out = $mustache->render($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)); // Parsed+Data $name = 'Parsed2'; $startMemory = memory_get_usage(true); $start = microtime(true); $tmpl = $mustache->parse($tmplStr); $data = new MustacheData($dataArr); for ($i = 0; $i < $count; $i++) { $out = $mustache->render($tmpl, $data); }