Pear Benchmarkをインストール
Benchmarkをインストールする
PHPのバージョンはphp5.5.10とする
##インストール
$ sudo /Applications/MAMP/bin/php/php5.5.10/bin/pear install -a http://pear.php.net/get/Benchmark
$ /Applications/MAMP/bin/php/php5.5.10/bin/pear list
##結果
Installed packages, channel pear.php.net:
=========================================
Package Version State
Archive_Tar 1.3.11 stable
Benchmark 1.2.9 stable
Console_Getopt 1.3.1 stable
PEAR 1.9.4 stable
Structures_Graph 1.0.4 stable
XML_Util 1.2.1 stable
##Benchmark
<?php
require_once 'Benchmark/Timer.php';
$timer = new Benchmark_Timer();
$timer->start();
for($i=0; $i < 1000; $i++){
sha1($i);
}
$timer->setMarker('sha()関数を1000回実行');
for($i=0; $i < 1000; $i++){
md5($i);
}
$timer->setMarker('md5()関数を1000回実行');
$timer->stop();
$timer->display();
?>