comparison vendor/zendframework/zend-stdlib/benchmark/RemovePriorityQueue.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
4 *
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
9
10 namespace ZendBench\Stdlib;
11
12 use Athletic\AthleticEvent;
13 use Zend\Stdlib\FastPriorityQueue;
14 use Zend\Stdlib\PriorityQueue;
15
16 class RemovePriorityQueue extends AthleticEvent
17 {
18 public function classSetUp()
19 {
20 $this->fastPriorityQueue = new FastPriorityQueue();
21 $this->priorityQueue = new PriorityQueue();
22
23 for ($i = 0; $i < 1000; $i += 1) {
24 $priority = rand(1, 100);
25 $this->fastPriorityQueue->insert('foo', $priority);
26 $this->priorityQueue->insert('foo', $priority);
27 }
28 }
29
30 /**
31 * @iterations 1000
32 */
33 public function removePriorityQueue()
34 {
35 $this->priorityQueue->remove('foo');
36 }
37
38 /**
39 * @iterations 1000
40 */
41 public function removeFastPriorityQueue()
42 {
43 $this->fastPriorityQueue->remove('foo');
44 }
45 }