LoginSignup
0
0

More than 5 years have passed since last update.

【FuelPHP】php-benchmark を入れてみる【メモ】

Last updated at Posted at 2017-10-26

はじめに

FuelPHP で処理速度測りたいとか色々思ったんです。
microtime でやっていたのですが、なんとなくその延長で入れてみましたので
記録として残していきます。

導入した benchmark は

php-benchmarkです。
https://github.com/lavoiesl/php-benchmark

以下導入方法

Fuelphp のあるところで、下記を実行する

$ composer require lavoiesl/php-benchmark

なんか入ったっぽい。

Using version ^1.4 for lavoiesl/php-benchmark
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing lavoiesl/php-benchmark (v1.4): Downloading (100%)         
Writing lock file
Generating autoload files
適当なコントローラで実行しようと思った

とりあえず入ったので、実行してみようかと思いました。
action に入れちゃおう。

<?
use Lavoiesl\PhpBenchmark\Benchmark;

class Controller_XX extends Controller
{
  public function action_XX()
  {
         $benchmark = new Benchmark;

         // add で追加したい関数など設定できるんですね。
     $benchmark->add('sample1', function(){ 
            return $this->sample1() });

    // 実行結果表示
    d($benchmark->run());
  }

  public function sample1() 
  {
     // (略)何かの処理
  }
}
終わりに

簡単に導入できてしまうと、すごい。って思う。
すごい。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0