fast-polylines 0.1.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 188b873d21a061c22675b35f10d0364dd81407c2
4
- data.tar.gz: d0a78755d81d3eecc329023a5956af078c1930b1
2
+ SHA256:
3
+ metadata.gz: 8481e1a1c0eeda19f205c7900fa58f3608e7092e88a1d90ffd4fabc4520706f1
4
+ data.tar.gz: d85050fd3d1796b76d40e8fbb2ae6d4ba18871359312c2648cf6831feba92bf8
5
5
  SHA512:
6
- metadata.gz: 206c7ddc05a9cd4585f3090ff3a75eec0a888a59c2413ffcfa3dfb6a60152f3295e0298eff098528bee4f1e9289a8f44ab71a5658aa2ca48aa9605ca6ff182cb
7
- data.tar.gz: 6ece894847da8d830754b09a096c250232e9f7cc4dd80758ea093a463130a24724b6c114b98f4db190684394720951bf4000a0afa5615b9e3b9300f46092036b
6
+ metadata.gz: 5ed680bb3cb3097c7b060d18d27b4a18a5def03ec6b0a79e918f61e763cb4f32477023e9db76bb660ea33a6fa0f5c8352781c11d63e2b2d1cc2d0a79c45bf134
7
+ data.tar.gz: e929f7f781e273068542d9b60c8344e6f2fa548dcaf0652787beaf3fd46bd6e162c588cb9c1616bd77342b8e69ce5954ad2799344485b212ba907f07f3f65ee9
data/README.md CHANGED
@@ -8,7 +8,36 @@ http://code.google.com/apis/maps/documentation/utilities/polylinealgorithm.html
8
8
 
9
9
  Greatly inspired by Joshua Clayton gem : https://github.com/joshuaclayton/polylines
10
10
 
11
- But an **at least 5x faster** implementation.
11
+ But an about **8x faster encoding** and **10x faster decoding** implementation (`make benchmark` on a MacBook pro 13 - 2,3 GHz Intel Core i5).
12
+
13
+ ```
14
+ ** ENCODING **
15
+
16
+ Warming up --------------------------------------
17
+ Polylines encode 282.000 i/100ms
18
+ FastPolylines encode 2.339k i/100ms
19
+ Calculating -------------------------------------
20
+ Polylines encode 3.024k (± 7.4%) i/s - 15.228k in 5.068950s
21
+ FastPolylines encode 24.562k (± 6.7%) i/s - 123.967k in 5.074793s
22
+
23
+ Comparison:
24
+ FastPolylines encode: 24561.8 i/s
25
+ Polylines encode: 3023.6 i/s - 8.12x slower
26
+
27
+
28
+ ** DECODING **
29
+
30
+ Warming up --------------------------------------
31
+ Polylines decode 125.000 i/100ms
32
+ FastPolylines decode 1.341k i/100ms
33
+ Calculating -------------------------------------
34
+ Polylines decode 1.284k (± 9.7%) i/s - 6.375k in 5.023536s
35
+ FastPolylines decode 13.278k (±20.5%) i/s - 61.686k in 5.003858s
36
+
37
+ Comparison:
38
+ FastPolylines decode: 13278.0 i/s
39
+ Polylines decode: 1284.3 i/s - 10.34x slower
40
+ ```
12
41
 
13
42
  ## Install
14
43
 
@@ -45,6 +74,10 @@ FastPolylines::Decoder.decode("_izlhA~rlgdF_{geC~ywl@_kwzCn`{nI", 1e6)
45
74
  # [[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]]
46
75
  ```
47
76
 
77
+ ## Run the Benchmark
78
+
79
+ You can run the benchmark with `make benchmark`.
80
+
48
81
  ## License
49
82
 
50
83
  Please see LICENSE
@@ -1,3 +1,3 @@
1
1
  module FastPolylines
2
- VERSION = "0.1.1".freeze
2
+ VERSION = "1.0.0".freeze
3
3
  end
@@ -8,13 +8,6 @@ describe FastPolylines::Decoder do
8
8
  it "should decode a polyline correctly" do
9
9
  expect(described_class.decode(polyline)).to eq points
10
10
  end
11
- it "should perform at least 5x faster than the Polylines gem" do
12
- expect {
13
- described_class.decode(polyline)
14
- }.to perform_faster_than {
15
- Polylines::Decoder.decode_polyline(polyline)
16
- }.at_least(5).times
17
- end
18
11
  end
19
12
  context "with 1e6 precision" do
20
13
  let(:polyline) { "_izlhA~rlgdF_{geC~ywl@_kwzCn`{nI" }
@@ -8,13 +8,6 @@ describe FastPolylines::Encoder do
8
8
  it "should encode points correctly" do
9
9
  expect(described_class.encode(points)).to eq polyline
10
10
  end
11
- it "should perform at least 5x faster than the Polylines gem" do
12
- expect {
13
- described_class.encode(points)
14
- }.to perform_faster_than {
15
- Polylines::Encoder.encode_points(points)
16
- }.at_least(5).times
17
- end
18
11
  end
19
12
  context "with 1e6 precision" do
20
13
  let(:polyline) { "_izlhA~rlgdF_{geC~ywl@_kwzCn`{nI" }
@@ -3,9 +3,6 @@ require "bundler/setup"
3
3
 
4
4
  require "fast-polylines"
5
5
 
6
- require "rspec-benchmark"
7
- require "polylines"
8
-
9
6
  RSpec.configure do |config|
10
- include RSpec::Benchmark::Matchers
7
+ # Additional config goes here
11
8
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fast-polylines
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyrille Courtière
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-22 00:00:00.000000000 Z
11
+ date: 2019-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rspec
14
+ name: benchmark-ips
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.5'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '3.5'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: polylines
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -39,19 +39,19 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.3'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec-benchmark
42
+ name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.3'
47
+ version: '3.5'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0.3'
54
+ version: '3.5'
55
55
  description:
56
56
  email:
57
57
  - cyrille@klaxit.com
@@ -86,8 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  - !ruby/object:Gem::Version
87
87
  version: '0'
88
88
  requirements: []
89
- rubyforge_project:
90
- rubygems_version: 2.5.2
89
+ rubygems_version: 3.0.2
91
90
  signing_key:
92
91
  specification_version: 4
93
92
  summary: Fast & easy Google polylines