ko/php-benchmark

A simple class for testing how long code takes to run

Installs: 76

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:project

pkg:composer/ko/php-benchmark

0.0.1 2018-04-25 17:43 UTC

This package is not auto-updated.

Last update: 2025-10-05 11:28:34 UTC


README

This module is for benchmarking PHP code to determine how long a particular procedure takes to run.

Install

composer require ko/php-benchmark

Usage

Class Object

Return the Benchmark class object of how long a procedure took to run.

  $mark = new \KO\Benchmark\Benchmark();

  sleep(3); // Some task that takes time to run
  
  echo $mark->calc();

Human Readable String

Return a human readable string of how long a procedure took to run.

  $mark = new \KO\Benchmark\Benchmark();

  sleep(3); // Some task that takes time to run

  echo $mark->calc()->toString();

Array

Return an Array of how long a procedure took to run.

  $mark = new \KO\Benchmark\Benchmark();

  sleep(3); // Some task that takes time to run

  var_dump( $mark->calc()->toArray() );