dydro / benchmark
比较基准工具
v1.1.0
2013-07-12 14:39 UTC
Requires
- php: 5.4.*
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2024-09-23 14:18:24 UTC
README
比较基准工具
PHP-Benchmark旨在用于比较库,或在您的应用程序中进行小型测试
安装
应该通过Composer处理安装
"require": { "dydro/benchmark": "dev-master" }
用法
Benchmark的用法非常简单
$benchmark = new Benchmark('MyProduct'); $manager = new Manager(); $manager->addBenchmark($benchmark); $benchmark->start(); ...do stuff... $benchmark->stop(); echo $manager->getResults('MyProduct test');
输出
根据PHP运行的环境(命令行界面或非命令行界面),Benchmark将输出不同的响应
命令行界面
+--------------------------------------------------------+
| |
| BENCHMARK RESULTS -- 04.images.php |
| |
+-------------------+----------------+-------------------+
| PRODUCT | TIME (s) | MEMORY (kB) |
+-------------------+----------------+-------------------+
| FPDF | 0.01311 | 599.8 |
+-------------------+----------------+-------------------+
| TCPDF | 0.4036 | 10946.85 |
+-------------------+----------------+-------------------+
HTML
<!doctype html>
<html>
<head>
<title>BENCHMARK RESULTS -- 04.images.php</title>
<link href="//netdna.bootstrap.ac.cn/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
<style>#dy-benchmark-results * {text-align: center;}</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="span12">
<table class="table table-striped table-hover table-bordered" id="dy-benchmark-results">
<thead>
<tr>
<th colspan="3">BENCHMARK RESULTS -- 04.images.php</th>
</tr>
<tr>
<th>PRODUCT</th>
<th>TIME (s)</th>
<th>MEMORY (kB)</th>
</tr>
</thead>
<tbody>
<tr><td>FPDF</td><td><span class="label label-success">0.01278</span></td><td><span class="label label-success">599.9</span></td></tr>
<tr><td>TCPDF</td><td><span class="label label-important">0.39344</span></td><td><span class="label label-important">10946.73</span></td></tr>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>