comparison vendor/zendframework/zend-stdlib/benchmark/InsertPriorityQueue.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 use Zend\Stdlib\SplPriorityQueue;
16
17 class InsertPriorityQueue extends AthleticEvent
18 {
19 public function classSetUp()
20 {
21 $this->splPriorityQueue = new SplPriorityQueue();
22 $this->fastPriorityQueue = new FastPriorityQueue();
23 $this->priorityQueue = new PriorityQueue();
24 }
25
26 /**
27 * @iterations 5000
28 */
29 public function insertSplPriorityQueue()
30 {
31 $this->splPriorityQueue->insert('foo', rand(1, 100));
32 }
33
34 /**
35 * @iterations 5000
36 */
37 public function insertPriorityQueue()
38 {
39 $this->priorityQueue->insert('foo', rand(1, 100));
40 }
41
42 /**
43 * @iterations 5000
44 */
45 public function insertFastPriorityQueue()
46 {
47 $this->fastPriorityQueue->insert('foo', rand(1, 100));
48 }
49 }