|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* (c) Dennis Meckel |
|
5
|
|
|
* |
|
6
|
|
|
* For the full copyright and license information, |
|
7
|
|
|
* please view the LICENSE file that was distributed with this source code. |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
namespace Rayne\wz2008\Graph\Benchmark; |
|
11
|
|
|
|
|
12
|
|
|
use PhpBench\Benchmark\Metadata\Annotations\AfterMethods; |
|
13
|
|
|
use PhpBench\Benchmark\Metadata\Annotations\BeforeMethods; |
|
14
|
|
|
use PhpBench\Benchmark\Metadata\Annotations\Groups; |
|
15
|
|
|
use PhpBench\Benchmark\Metadata\Annotations\Iterations; |
|
16
|
|
|
use PhpBench\Benchmark\Metadata\Annotations\ParamProviders; |
|
17
|
|
|
use PhpBench\Benchmark\Metadata\Annotations\Revs; |
|
18
|
|
|
use PhpBench\Benchmark\Metadata\Annotations\Warmup; |
|
19
|
|
|
|
|
20
|
|
|
abstract class ParentItemAccessCase extends BaseCase |
|
21
|
|
|
{ |
|
22
|
|
|
/** |
|
23
|
|
|
* @return array[] |
|
24
|
|
|
*/ |
|
25
|
|
|
public function provideChildAndParentIds() |
|
26
|
|
|
{ |
|
27
|
|
|
return [ |
|
28
|
|
|
['child' => '74.10.2', 'parent' => '74.10'], |
|
29
|
|
|
['child' => '74.10', 'parent' => '74.1'], |
|
30
|
|
|
['child' => '74.1', 'parent' => '74'], |
|
31
|
|
|
['child' => '74', 'parent' => 'M'], |
|
32
|
|
|
]; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @Groups({"Parent Access"}) |
|
37
|
|
|
* @ParamProviders({"provideChildAndParentIds"}) |
|
38
|
|
|
* |
|
39
|
|
|
* @Warmup(1) |
|
40
|
|
|
* @Revs(33) |
|
41
|
|
|
* @Iterations(3) |
|
42
|
|
|
* |
|
43
|
|
|
* @param array $params |
|
44
|
|
|
*/ |
|
45
|
|
|
abstract public function benchColdParentItemAccess(array $params); |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @param array $params |
|
49
|
|
|
*/ |
|
50
|
|
|
abstract public function beforeWarmParentItemAccess(array $params); |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* @Groups({"Parent Access"}) |
|
54
|
|
|
* @ParamProviders({"provideChildAndParentIds"}) |
|
55
|
|
|
* @BeforeMethods({"beforeWarmParentItemAccess"}) |
|
56
|
|
|
* @AfterMethods({"afterWarmParentItemAccess"}) |
|
57
|
|
|
* |
|
58
|
|
|
* @Warmup(1) |
|
59
|
|
|
* @Revs(33) |
|
60
|
|
|
* @Iterations(3) |
|
61
|
|
|
* |
|
62
|
|
|
* @param array $params |
|
63
|
|
|
*/ |
|
64
|
|
|
abstract public function benchWarmParentItemAccess(array $params); |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @param array $params |
|
68
|
|
|
*/ |
|
69
|
|
|
abstract public function afterWarmParentItemAccess(array $params); |
|
70
|
|
|
} |
|
71
|
|
|
|