2017 © Pedro Peláez
 

library phpbench

PHP benchmarking helper

image

rzajac/phpbench

PHP benchmarking helper

  • Saturday, December 5, 2015
  • by rzajac
  • Repository
  • 1 Watchers
  • 0 Stars
  • 18 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

Benchmarking for PHP

This tool helps writing benchmarks that can be run during testing or some other automated deployment procedure., (*1)

Usage

Command line options:, (*2)

$ phpbench bench -h
Usage:
  bench [options] [--] [<fileOrDir>]

Arguments:
  fileOrDir                      file or directory with benchmarks

Options:
  -f, --format[=FORMAT]          output format: txt, csv. [default: "txt"]
  -i, --iterations[=ITERATIONS]  number of benchmarking iterations [default: 10000]
  -h, --help                     Display this help message
  -q, --quiet                    Do not output any message
  -V, --version                  Display this application version
      --ansi                     Force ANSI output
      --no-ansi                  Disable ANSI output
  -n, --no-interaction           Do not ask any interactive question
  -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Help:
 Run benchmark

Run all benchmarks in examples directory:, (*3)

$ phpbench bench examples/

Benchmark files must end with Bench.php., (*4)

Run benchmarks from specific file:, (*5)

$ phpbench bench examples/ArrayKeyExistsBench.php

Example output:

Human readable:, (*6)

$ ./phpbench bench examples/

ArrayKeyExistsBench.php
 Benchmark            empty: execution: 100.00 % (0.000416 sec), memory: 100.00 % (536 B), speed: 24 038 462 /sec
 Benchmark            isset: execution: 112.02 % (0.000466 sec), memory: 131.34 % (704 B), speed: 21 459 228 /sec
 Benchmark array_key_exists: execution: 407.93 % (0.001697 sec), memory: 105.97 % (568 B), speed: 5 892 752 /sec

CloneDateBench.php
 Benchmark clone_date: execution: 100.00 % (0.016790 sec), memory: 100.00 % (568 B), speed: 595 593 /sec
 Benchmark   new_date: execution: 240.71 % (0.040416 sec), memory: 101.41 % (576 B), speed: 247 427 /sec

DateToIntBench.php
 Benchmark str_replace_array: execution: 100.00 % (0.007662 sec), memory: 100.00 % (568 B), speed: 1 305 143 /sec
 Benchmark            substr: execution: 145.82 % (0.011173 sec), memory: 105.63 % (600 B), speed: 895 015 /sec
 Benchmark              preg: execution: 156.68 % (0.012005 sec), memory: 100.00 % (568 B), speed: 832 987 /sec
 Benchmark       str_replace: execution: 168.22 % (0.012889 sec), memory: 101.41 % (576 B), speed: 775 856 /sec

DefineConstBench.php
 Benchmark define: execution: 100.00 % (0.005355 sec), memory: 100.00 % (584 B), speed: 1 867 414 /sec
 Benchmark  const: execution: 199.42 % (0.010679 sec), memory: 100.00 % (584 B), speed: 936 418 /sec

MagicCallBench.php
 Benchmark direct: execution: 100.00 % (0.002248 sec), memory: 100.00 % (576 B), speed: 4 448 399 /sec
 Benchmark cached: execution: 497.78 % (0.011190 sec), memory: 108.33 % (624 B), speed: 893 656 /sec

CSV format:, (*7)

$ ./phpbench bench examples/ -f csv
Name,Case,Execution Percent,Execution Seconds,Memory Percent,Memory Bytes,Operations Per Second
ArrayKeyExistsBench.php,empty,100.00,0.002145,100.00,536,4662005
ArrayKeyExistsBench.php,isset,106.48,0.002284,128.36,688,4378284
ArrayKeyExistsBench.php,array_key_exists,595.99,0.012784,105.97,568,782228CloneDateBench.php,clone_date,100.00,0.037434,100.00,568,267137
CloneDateBench.php,new_date,241.85,0.090536,101.41,576,110454DateToIntBench.php,str_replace_array,100.00,0.018342,100.00,568,545197
DateToIntBench.php,preg,150.61,0.027624,100.00,568,362005
DateToIntBench.php,str_replace,186.33,0.034176,101.41,576,292603
DateToIntBench.php,substr,332.19,0.060930,105.63,600,164123DefineConstBench.php,define,100.00,0.035186,100.00,584,284204
DefineConstBench.php,const,125.35,0.044107,100.00,584,226722MagicCallBench.php,direct,100.00,0.015866,100.00,576,630279
MagicCallBench.php,cached,500.72,0.079445,108.33,624,125874

Usage in code:

See code., (*8)

Installation

Composer install:, (*9)

{
    "require": {
        "rzajac/phpbench": "~0.6"
    }
}

Composer globally:, (*10)

$ composer global require rzajac/phpbench

The Versions

05/12 2015

dev-master

9999999-dev

PHP benchmarking helper

  Sources   Download

Apache License 2.0

The Requires

 

The Development Requires

by Rafal Zajac

04/12 2015

0.6.3

0.6.3.0

PHP benchmarking helper

  Sources   Download

Apache License 2.0

The Requires

 

The Development Requires

by Rafal Zajac

04/12 2015

0.6.2

0.6.2.0

PHP benchmarking helper

  Sources   Download

Apache License 2.0

The Requires

 

The Development Requires

by Rafal Zajac

04/12 2015

0.6.1

0.6.1.0

PHP benchmarking helper

  Sources   Download

Apache License 2.0

The Requires

 

The Development Requires

by Rafal Zajac

29/11 2015

0.6.0

0.6.0.0

PHP benchmarking helper

  Sources   Download

Apache License 2.0

The Requires

 

by Rafal Zajac

02/11 2015

0.5.3

0.5.3.0

PHP benchmarking helper

  Sources   Download

Apache License 2.0

The Requires

 

by Rafal Zajac

11/10 2015

0.5.1

0.5.1.0

PHP benchmarking helper

  Sources   Download

Apache License 2.0

The Requires

  • php >=5.5.0

 

The Development Requires

by Rafal Zajac

10/10 2015

0.5.0

0.5.0.0

PHP benchmarking helper

  Sources   Download

Apache License 2.0

The Requires

  • php >=5.5.0

 

The Development Requires

by Rafal Zajac