darraghb / bottler
A package to find bottlenecks in your php project.
v1.0.2
2023-02-23 17:02 UTC
This package is not auto-updated.
Last update: 2025-07-25 04:33:25 UTC
README
A package to time test the performance of functions
Usage
$bottler->staticPerformance('methodName', 'arg1', 'arg2');
Setup
composer require darraghb/bottler
Initialize bottler
require_once '../vendor/autoload.php'; use Darraghb\Bottler\Bottler; #Initialize bottler and specify the unit of measurement (seconds|nanoseconds) $bottler = new Bottler( ['unit' => 'seconds', 'fileName' => __FILE__]);
Run a test on a static method
$bottler->staticPerformance('mySlowTest', 20, 5000); function mySlowTest($start= false, $loop = false) { $ans = ''; for ($i=0; $i < $loop; $i++) { $ans = $i; } }
Run a test on a method within a class
make sure to include $this in the initializer
$bottler = new Bottler( ['unit' => 'seconds', 'fileName' => __FILE__, 'this' => $this]); $bottler->performance('methodName', 20, 5000);