fenom/benchmark/scripts/run.php

32 lines
739 B
PHP
Raw Normal View History

<?php
$opt = getopt("", array(
2013-07-22 18:03:43 +04:00
/** @var string $engine */
"engine:",
2013-07-22 18:03:43 +04:00
/** @var string $template */
"template:",
2013-07-22 18:03:43 +04:00
/** @var string $data */
"data:",
2013-07-22 18:03:43 +04:00
/** @var boolean $double */
"double",
2013-07-22 18:03:43 +04:00
/** @var string $message */
"message:",
/** @var boolean $stress */
"stress:",
/** @var boolean $auto_reload */
"auto_reload"
));
require_once __DIR__.'/bootstrap.php';
2013-07-22 18:03:43 +04:00
$opt += array(
"message" => "plain",
"stress" => 0,
);
extract($opt);
2013-07-22 18:03:43 +04:00
$time = Benchmark::$engine($template, json_decode(file_get_contents($data), true), isset($double), $stress, isset($auto_reload));
printf(Benchmark::OUTPUT, $engine, $message, round($time, 4), round(memory_get_peak_usage()/1024/1024, 2));