|
1 | 1 | <?php |
2 | 2 |
|
3 | | -/** |
4 | | - * @see https://github.com/laminas/laminas-stdlib for the canonical source repository |
5 | | - * @copyright https://github.com/laminas/laminas-stdlib/blob/master/COPYRIGHT.md |
6 | | - * @license https://github.com/laminas/laminas-stdlib/blob/master/LICENSE.md New BSD License |
7 | | - */ |
| 3 | +declare(strict_types=1); |
8 | 4 |
|
9 | 5 | namespace LaminasBench\Stdlib; |
10 | 6 |
|
11 | 7 | use Laminas\Stdlib\FastPriorityQueue; |
12 | 8 | use Laminas\Stdlib\PriorityQueue; |
13 | 9 | use Laminas\Stdlib\SplPriorityQueue; |
14 | | -use PhpBench\Benchmark\Metadata\Annotations\Iterations; |
15 | | -use PhpBench\Benchmark\Metadata\Annotations\Revs; |
16 | | -use PhpBench\Benchmark\Metadata\Annotations\Warmup; |
| 10 | +use PhpBench\Attributes\Iterations; |
| 11 | +use PhpBench\Attributes\Revs; |
| 12 | +use PhpBench\Attributes\Warmup; |
17 | 13 |
|
18 | 14 | use function rand; |
19 | 15 |
|
20 | | -/** |
21 | | - * @Revs(1000) |
22 | | - * @Iterations(10) |
23 | | - * @Warmup(2) |
24 | | - */ |
25 | | -class InsertPriorityQueueBench |
| 16 | +#[Revs(1000)] |
| 17 | +#[Iterations(10)] |
| 18 | +#[Warmup(2)] |
| 19 | +final class InsertPriorityQueueBench |
26 | 20 | { |
| 21 | + private SplPriorityQueue $splPriorityQueue; |
| 22 | + private FastPriorityQueue $fastPriorityQueue; |
| 23 | + private PriorityQueue $priorityQueue; |
| 24 | + |
27 | 25 | public function __construct() |
28 | 26 | { |
29 | 27 | $this->splPriorityQueue = new SplPriorityQueue(); |
30 | 28 | $this->fastPriorityQueue = new FastPriorityQueue(); |
31 | 29 | $this->priorityQueue = new PriorityQueue(); |
32 | 30 | } |
33 | 31 |
|
34 | | - public function benchInsertSplPriorityQueue() |
| 32 | + public function benchInsertSplPriorityQueue(): void |
35 | 33 | { |
36 | 34 | $this->splPriorityQueue->insert('foo', rand(1, 100)); |
37 | 35 | } |
38 | 36 |
|
39 | | - public function benchInsertPriorityQueue() |
| 37 | + public function benchInsertPriorityQueue(): void |
40 | 38 | { |
41 | 39 | $this->priorityQueue->insert('foo', rand(1, 100)); |
42 | 40 | } |
43 | 41 |
|
44 | | - public function benchInsertFastPriorityQueue() |
| 42 | + public function benchInsertFastPriorityQueue(): void |
45 | 43 | { |
46 | 44 | $this->fastPriorityQueue->insert('foo', rand(1, 100)); |
47 | 45 | } |
|
0 commit comments