2017 © Pedro Peláez
 

library measure

Measuring performance of different implementations in an xUnit-style way

image

xp-forge/measure

Measuring performance of different implementations in an xUnit-style way

  • Sunday, June 4, 2017
  • by thekid
  • Repository
  • 3 Watchers
  • 0 Stars
  • 328 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Measure

Build status on GitHub XP Framework Module BSD Licence Requires PHP 7.0+ Supports PHP 8.0+ Latest Stable Version, (*1)

Measuring performance of different implementations in an xUnit-style way., (*2)

Example

use util\profiling\{Measure, Measurable};

class Iteration extends Measurable {

  #[Measure]
  public function strpos() {
    return false === ($p= strpos('abc.', '.')) ? -1 : $p;
  }

  #[Measure]
  public function strcspn() {
    return 4 === ($p= strcspn('abc.', '.')) ? -1 : $p;
  }
}

Running:, (*3)

$ xp measure -1000000 Demo
strpos: 1000000 iteration(s), 0.308 seconds, result= 3
strcspn: 1000000 iteration(s), 0.350 seconds, result= 3

Permutation

use util\profiling\{Measure, Measurable, Values};

class Demo extends Measurable {

  #[Measure, Values(['', '.', '.a', 'a.', 'a.b'])]
  public function strpos($fixture) {
    return false === ($p= strpos($fixture, '.')) ? -1 : $p;
  }

  #[Measure, Values(['', '.', '.a', 'a.', 'a.b'])]
  public function strcspn($fixture) {
    return strlen($fixture) === ($p= strcspn($fixture, '.')) ? -1 : $p;
  }
}

Running:, (*4)

$ xp measure -1000000 Demo
strpos(""): 1000000 iteration(s), 0.534 seconds, result= -1
strpos("."): 1000000 iteration(s), 0.527 seconds, result= 0
strpos(".a"): 1000000 iteration(s), 0.523 seconds, result= 0
strpos("a."): 1000000 iteration(s), 0.531 seconds, result= 1
strpos("a.b"): 1000000 iteration(s), 0.541 seconds, result= 1
strcspn(""): 1000000 iteration(s), 0.633 seconds, result= -1
strcspn("."): 1000000 iteration(s), 0.617 seconds, result= 0
strcspn(".a"): 1000000 iteration(s), 0.622 seconds, result= 0
strcspn("a."): 1000000 iteration(s), 0.605 seconds, result= 1
strcspn("a.b"): 1000000 iteration(s), 0.613 seconds, result= 1

The Versions

04/06 2017

dev-master

9999999-dev http://xp-framework.net/

Measuring performance of different implementations in an xUnit-style way

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

module xp

04/06 2017

v2.0.0

2.0.0.0 http://xp-framework.net/

Measuring performance of different implementations in an xUnit-style way

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

module xp

12/04 2017

v1.1.0

1.1.0.0 http://xp-framework.net/

Measuring performance of different implementations in an xUnit-style way

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

module xp

21/02 2016

v1.0.0

1.0.0.0 http://xp-framework.net/

Measuring performance of different implementations in an xUnit-style way

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

module xp

14/06 2015

v0.4.0

0.4.0.0 http://xp-framework.net/

Measuring performance of different implementations in an xUnit-style way

  Sources   Download

BSD-3-Clause

The Requires

 

module xp

12/02 2015

v0.3.0

0.3.0.0 http://xp-framework.net/

Measuring performance of different implementations in an xUnit-style way

  Sources   Download

BSD-3-Clause

The Requires

 

module xp

10/01 2015

v0.2.0

0.2.0.0 http://xp-framework.net/

Measuring performance of different implementations in an xUnit-style way

  Sources   Download

BSD-3-Clause

The Requires

 

module xp