Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge pull request #19 from ezimuel/feature/fastpriorityqueue
Browse files Browse the repository at this point in the history
Added the FastPriorityQueue implementation
  • Loading branch information
weierophinney committed Sep 17, 2015
2 parents 297c699 + a0028d9 commit b29d14d
Show file tree
Hide file tree
Showing 5 changed files with 562 additions and 2 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ class for different scopes like:
- string wrappers;
- etc.

## Benchmarks

We provided some benchmarks for zend-stdlib in the folder [/benchmark](/benchmark).
We used [athletic](https://github.com/polyfractal/athletic) framework to write the benchmark tests.
You can execute the benchmarks running the following command:

```
vendor/bin/athletic -p benchmark
```

-
- File issues at https://github.com/zendframework/zend-stdlib/issues
- Documentation is at http://framework.zend.com/manual/current/en/index.html#zend-stdlib
69 changes: 69 additions & 0 deletions benchmark/PriorityQueue.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php
namespace ZendBench\Stdlib;

use Athletic\AthleticEvent;

class PriorityQueue extends AthleticEvent
{
public function classSetUp()
{
$this->splPriorityQueue = new \Zend\Stdlib\SplPriorityQueue();
$this->fastPriorityQueue = new \Zend\Stdlib\FastPriorityQueue();
$this->priorityQueue = new \Zend\Stdlib\PriorityQueue();

for($i=0; $i<5000; $i++) {
$priority = rand(1,100);
$this->splPriorityQueue->insert('foo', $priority);
$this->fastPriorityQueue->insert('foo', $priority);
$this->priorityQueue->insert('foo', $priority);
}
}

/**
* @iterations 5000
*/
public function insertSplPriorityQueue()
{
$this->splPriorityQueue->insert('foo', rand(1,100));
}

/**
* @iterations 5000
*/
public function extractSplPriorityQueue()
{
$this->splPriorityQueue->extract();
}

/**
* @iterations 5000
*/
public function insertPriorityQueue()
{
$this->priorityQueue->insert('foo', rand(1,100));
}

/**
* @iterations 5000
*/
public function extractPriorityQueue()
{
$this->priorityQueue->extract();
}

/**
* @iterations 5000
*/
public function insertFastPriorityQueue()
{
$this->fastPriorityQueue->insert('foo', rand(1,100));
}

/**
* @iterations 5000
*/
public function extractFastPriorityQueue()
{
$this->fastPriorityQueue->extract();
}
}
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"zendframework/zend-servicemanager": "~2.5",
"zendframework/zend-filter": "~2.5",
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/PHPUnit": "~4.0"
"phpunit/PHPUnit": "~4.0",
"athletic/athletic": "~0.1"
},
"suggest": {
"zendframework/zend-eventmanager": "To support aggregate hydrator usage",
Expand All @@ -41,7 +42,8 @@
},
"autoload-dev": {
"psr-4": {
"ZendTest\\Stdlib\\": "test/"
"ZendTest\\Stdlib\\": "test/",
"ZendBench\\Stdlib\\": "benchmark/"
}
}
}
Loading

0 comments on commit b29d14d

Please sign in to comment.