/
ExecuteBenchmark.php
63 lines (54 loc) · 1.19 KB
/
ExecuteBenchmark.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
namespace Auryn\Test\Benchmark;
use Athletic\AthleticEvent;
use Auryn\Injector;
class ExecuteBenchmark extends AthleticEvent
{
private $injector;
private $noop;
public function classSetUp()
{
$this->injector = new Injector();
$this->noop = new Noop();
}
/**
* @baseline
* @iterations 10000
*/
public function native_invoke_closure()
{
call_user_func(function () {
// call-target, intenionally left empty
});
}
/**
* @iterations 10000
*/
public function native_invoke_method()
{
call_user_func(array($this->noop, 'noop'));
}
/**
* @iterations 10000
*/
public function invoke_closure()
{
$this->injector->execute(function () {
// call-target, intenionally left empty
});
}
/**
* @iterations 10000
*/
public function invoke_method()
{
$this->injector->execute(array($this->noop, 'noop'));
}
/**
* @iterations 10000
*/
public function invoke_with_named_parameters()
{
$this->injector->execute(array($this->noop, 'namedNoop'), array(':name' => 'foo'));
}
}