Skip to content

Instantly share code, notes, and snippets.

@ivastly
Last active January 8, 2020 00:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivastly/c22efa14be15a9ac2bb260f8f338b84a to your computer and use it in GitHub Desktop.
Save ivastly/c22efa14be15a9ac2bb260f8f338b84a to your computer and use it in GitHub Desktop.
benchmark for an empty method call in PHP
<?php declare(strict_types=1);
/**
* @Revs(1000000)
* @Iterations(1000)
* @Warmup(10)
* @BeforeMethods("init")
* @OutputTimeUnit("microseconds", precision=1)
*/
class MethodCallBench
{
/** @var EmptyClass */
private $object;
public function init(): void
{
require_once __DIR__ . '/EmptyClass.php';
$this->object = new EmptyClass();
}
public function benchPureMethodCallOverhead(): void
{
$this->object->m();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment