To ease the PHP development, (*1)
Installation
$ vim composer.json
{
  "require": {
    "mudasobwa/screwdrivers": "0.1.*"
  }
}
$ curl http://getcomposer.org/installer | php
$ php composer.phar install --prefer-source
YardStick
YardStick is a class, providing easy access to benchmarking., (*2)
It allows the embedded-in-code becnhmarks, such as:, (*3)
β¦
$ys = new \Mudasobwa\Screwdrivers\YardStick(true);
$ys->milestone('YS1#Start');
$my_obj->perform_long_operation($param1, $param2);
$ys->milestone('YS2');
$my_obj->perform_long_operation($param3, $param4);
$ys->milestone('YS1#Finish');
$ys->report('YS.+'); // report measures for milestones `YS*`
The output will be looking like:, (*4)
==== Results for tag: [1396189882.6664-YS1#Start]
--   β Time     β 03/30/14 14:31:22
--   β Memory:  β 6915KB
--   Peak (1m): β 7075KB
--   Load:      β 0.82
==== Diff for tags: [1396189882.6664 :: 1396189882.6989]
--   βΒ Time:    β 0.032443 sec
--   β Memory:  β 7.0 KB
==== Diff for tags: [1396189882.6989 :: 1396189882.98]
--   βΒ Time:    β 0.281102 sec
--   β Memory:  β 5.9 KB
ββββββββββββββββββββββββββββββββββββββ
==== Diff for tags: [1396189882.6664 :: 1396189882.98]
--   βΒ Time:    β 0.313545 sec
--   β Memory:  β 12.9 KB
Another way is to measure the specific methods (and/or compare them):, (*5)
\Mudasobwa\Screwdrivers\YardStick::benchmark(
   new FlexibleString('Hello, world!'), 'replace', array('/l/', 'L')
);