Last active
January 8, 2020 00:03
-
-
Save ivastly/c22efa14be15a9ac2bb260f8f338b84a to your computer and use it in GitHub Desktop.
benchmark for an empty method call in PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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