priority_queue_cxx 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +6 -4
- data/ext/fast_containers/fc_pq.cpp +2 -2
- data/ext/fast_containers/fc_pq.h +1 -1
- metadata +5 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9ba1b848409a000b5cb7ee56d1ae562eb7192aa7d705365a6f3b7a56729fbc89
|
4
|
+
data.tar.gz: 7a42739b6d89de0bce7e989938cfa352f8a32152cf0a43e377e584b22914374c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a7e866717d1e8c178f671bdb268180ac618d67a6e9489d027d28575179eab562866a87681ca1b539e6eddca2ef136e4494e7da3e58226a922f25ecde0ab8543
|
7
|
+
data.tar.gz: 1623288217123aac3da66d238c9178b21ff5aaa14421390c59d901d80ec2d861246972895b0d372fc97e9336f3a4636e8fa3242809e25342b8e77a726a331051
|
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# PriorityQueueCxx
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/priority_queue_cxx.png)](http://badge.fury.io/rb/priority_queue_cxx)
|
4
|
+
[![priority_queue_cxx API Documentation](https://www.omniref.com/ruby/gems/priority_queue_cxx.png)](https://www.omniref.com/ruby/gems/priority_queue_cxx)
|
4
5
|
|
5
|
-
|
6
|
+
|
7
|
+
*PriorityQueueCxx* provides a fast implementation of priority queues for ruby. Speed is achieved by exposing the c++ standard implementation through a light ruby wrapper. As a bigger project, the library may grow to provide a number of containers that are not in the standard ruby library and are presently only available as pure ruby libraries. Presently, however, the library includes a single class named PriorityQueue. More containers will be added as necessity arises. Contributors and feature requests are most welcome.
|
6
8
|
|
7
9
|
The library exposes a module named ```FastContainers``` (to be required using ```require 'fc'```) which provides the PriorityQueue class.
|
8
10
|
|
@@ -29,7 +31,7 @@ q.pop
|
|
29
31
|
|
30
32
|
As far as I know, only one other library (the PriorityQueue gem) provides priority queues implemented as a C extension. This implies that the fc::PriorityQueue is a *lot* faster than most current alternatives and, as shown below, it compares favorably with the mentioned C extension as well.
|
31
33
|
|
32
|
-
To get an idea about how fast it is, below
|
34
|
+
To get an idea about how fast it is, below I provide a comparison of the time needed to push and pop a large number of elements into a priority queue. Each experiment compares FastContainers with other priority queues implementations. Since timings varies greatly among different implementations, the number of push/pop performed is chosen so to make the experiments to run for (at most) few minutes.
|
33
35
|
|
34
36
|
The following table summarizes the outputs, detailed results can be found in the next few sections. All libraries have been installed through the 'gem' command and executed using ruby v. 2.1.0.
|
35
37
|
|
@@ -42,7 +44,7 @@ The following table summarizes the outputs, detailed results can be found in the
|
|
42
44
|
| algorithms | 2584.6 | 29.6 |1307.1 |
|
43
45
|
| priority_queue | 1.4 |19134.6 |9568.0 |
|
44
46
|
|
45
|
-
where: results are sorted according to "avg μs per op" (higher is better); μs stands for micro seconds; op stands for any operation (push or pop); the figures for priority_queue_cxx has been calculated with the results of experiments with PriorityQueue (the experiment with the highest number of operations).
|
47
|
+
where: results are sorted according to "avg μs per op" (higher in the list is better); μs stands for micro seconds; op stands for any operation (push or pop); the figures for priority_queue_cxx has been calculated with the results of experiments with PriorityQueue (the experiment with the highest number of operations).
|
46
48
|
|
47
49
|
|
48
50
|
### Comparison with [algorithms (0.6.1)](http://rubygems.org/gems/algorithms) (50,000 push/pop)
|
@@ -205,7 +207,7 @@ As it usually happens, the answer is: it depends. The evidence reported above sh
|
|
205
207
|
|
206
208
|
## API
|
207
209
|
|
208
|
-
Here it follows a transcription of the RDoc documentation for the library. I'm adding it here because I'
|
210
|
+
Here it follows a transcription of the RDoc documentation for the library. I'm adding it here because I'm having difficulties in instructing the 'gem' executable to generate the correct files on installation (everything works fine using rdoc from the command line though). Any suggestion about how to solve this problem is *very* welcome.
|
209
211
|
|
210
212
|
### FastContainers::PriorityQueue
|
211
213
|
|
@@ -117,7 +117,7 @@ namespace fc_pq {
|
|
117
117
|
_PQueueIterator(PQueue q) : iterator(q->storage.begin()), pqueue(q), storage(&q->storage), version(q->version)
|
118
118
|
{ }
|
119
119
|
|
120
|
-
void checkVersion()
|
120
|
+
void checkVersion() {
|
121
121
|
if(version != pqueue->version) {
|
122
122
|
throw PQueueException("FastContainers::PriorityQueue - a change in the priority queue invalidated the current iterator.");
|
123
123
|
}
|
@@ -146,7 +146,7 @@ namespace fc_pq {
|
|
146
146
|
}
|
147
147
|
|
148
148
|
/* Moves on to the next element */
|
149
|
-
PQueueIterator iterator_next(PQueueIterator it)
|
149
|
+
PQueueIterator iterator_next(PQueueIterator it) {
|
150
150
|
it->checkVersion();
|
151
151
|
it->iterator++;
|
152
152
|
return it;
|
data/ext/fast_containers/fc_pq.h
CHANGED
@@ -75,7 +75,7 @@ namespace fc_pq {
|
|
75
75
|
double iterator_get_key(PQueueIterator it);
|
76
76
|
|
77
77
|
/* Moves on to the next element */
|
78
|
-
PQueueIterator iterator_next(PQueueIterator it)
|
78
|
+
PQueueIterator iterator_next(PQueueIterator it);
|
79
79
|
|
80
80
|
/* Return true if the iterator is already out of the container */
|
81
81
|
bool iterator_end(PQueueIterator it);
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: priority_queue_cxx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Esposito
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2014-03-25 00:00:00.000000000 Z
|
@@ -50,7 +50,7 @@ homepage: https://github.com/boborbt/priority_queue_cxx
|
|
50
50
|
licenses:
|
51
51
|
- MIT
|
52
52
|
metadata: {}
|
53
|
-
post_install_message:
|
53
|
+
post_install_message:
|
54
54
|
rdoc_options:
|
55
55
|
- "--main"
|
56
56
|
- README.md
|
@@ -67,10 +67,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
requirements: []
|
70
|
-
|
71
|
-
|
72
|
-
signing_key:
|
70
|
+
rubygems_version: 3.3.11
|
71
|
+
signing_key:
|
73
72
|
specification_version: 4
|
74
73
|
summary: Fast (c++ wrapper) priority queue implementation for ruby.
|
75
74
|
test_files: []
|
76
|
-
has_rdoc:
|