Skip to content

fix: remove terraformer-wkt-parser dependency - #9545

Merged
sushantdhiman merged 1 commit into
masterfrom
use-wkx
Jun 16, 2018
Merged

fix: remove terraformer-wkt-parser dependency#9545
sushantdhiman merged 1 commit into
masterfrom
use-wkx

Conversation

@sushantdhiman

Copy link
Copy Markdown
Contributor

Pull Request check-list

Please make sure to review and check all of these items:

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Have you added new tests to prevent regressions?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description of change

@codecov

codecov Bot commented Jun 16, 2018

Copy link
Copy Markdown

Codecov Report

Merging #9545 into master will decrease coverage by <.01%.
The diff coverage is 40%.

@sushantdhiman

Copy link
Copy Markdown
Contributor Author

Opposite of #5682, ironically now terraformer is slower than wkx

var Benchmark = require('test.benchmark')
global.wkx = require('wkx')
global.wkt = require('terraformer-wkt-parser')

global.polygon = { "type": "Polygon", "coordinates": [ [ [ 8.26171875, 49.03786794532644 ], [ 11.77734375, 33.87041555094183 ], [ 39.55078125, 50.401515322782366 ], [ 27.421875, 61.270232790000634 ], [ 10.1953125, 62.99515845212052 ], [ -9.667968749999998, 51.28940590271679 ], [ -7.3828125, 32.99023555965106 ], [ -36.73828124999999, 11.350796722383684 ], [ -11.42578125, -44.46515101351962 ], [ 25.6640625, -12.897489183755892 ], [ 23.73046875, 13.581920900545844 ], [ 31.113281249999996, 23.725011735951796 ], [ 8.26171875, 49.03786794532644 ] ] ] }
global.linestring = { "type": "LineString", "coordinates": [ [ -16.171875, 71.07405646336098 ], [ 49.04296875, 69.28725695167886 ], [ 46.58203125, 40.84706035607122 ], [ 29.70703125, -8.407168163601076 ], [ -13.886718749999998, -28.14950321154457 ], [ -108.10546875, 34.30714385628804 ], [ -81.73828125, 56.65622649350222 ], [ -88.24218749999999, 36.4566360115962 ], [ -94.21875, -7.01366792756663 ], [ -92.46093749999999, -6.315298538330021 ], [ -91.40625, -4.214943141390639 ], [ -89.6484375, -5.090944175033373 ], [ -88.76953125, -8.407168163601076 ], [ -81.03515625, -7.536764322084078 ], [ -48.8671875, 57.98480801923985 ], [ -40.78125, 47.39834920035926 ], [ -54.84375, 22.43134015636061 ], [ -57.30468749999999, -17.14079039331665 ], [ -47.63671875, -33.43144133557529 ], [ -36.9140625, -7.01366792756663 ] ] }
global.points = [ { "type": "Point", "coordinates": [ 16.69921875, 68.59248658252947 ] }, { "type": "Point", "coordinates": [ 54.4921875, 36.73888412439431 ] }, { "type": "Point", "coordinates": [ 8.7890625, 16.29905101458183 ] }, { "type": "Point", "coordinates": [ -6.85546875, 38.685509760012 ] }, { "type": "Point", "coordinates": [ 16.5234375, 58.63121664342478 ] }, { "type": "Point", "coordinates": [ -2.4609375, 59.88893689676585 ] }, { "type": "Point", "coordinates": [ -53.96484375, 70.25945200030638 ] }, { "type": "Point", "coordinates": [ -98.4375, 58.17070248348612 ] }, { "type": "Point", "coordinates": [ -104.94140625, 31.653381399664 ] }, { "type": "Point", "coordinates": [ -94.74609375, 39.774769485295465 ] }, { "type": "Point", "coordinates": [ -35.5078125, 40.3130432088809 ] }, { "type": "Point", "coordinates": [ -103.18359375, -34.161818161230386 ] }, { "type": "Point", "coordinates": [ -48.515625, -24.04646399966658 ] }, { "type": "Point", "coordinates": [ -61.34765625, -9.10209673872643 ] } ]

Benchmark.runWithDefaults([
  Benchmark.syncSuite('polygon', {
    wkx: function() {
      wkx.Geometry.parseGeoJSON(polygon).toWkt()
    },
    terraformer: function() {
      wkt.convert(polygon)
    }
  }),
  Benchmark.syncSuite('linestring', {
    wkx: function() {
      wkx.Geometry.parseGeoJSON(linestring).toWkt()
    },
    terraformer: function() {
      wkt.convert(linestring)
    }
  }),
  Benchmark.syncSuite('points', {
    wkx: function() {
      points.forEach(function (x) { wkx.Geometry.parseGeoJSON(x).toWkt() })
    },
    terraformer: function() {
      points.forEach(function (x) { wkt.convert(x) })
    }
  })
])
Benchmarks for: polygon...

o wkx x 418,250 ops/sec ±2.15% (135 runs sampled)
o terraformer x 166,498 ops/sec ±2.64% (127 runs sampled)

Fastest: wkx
Slowest: terraformer

---

Benchmarks for: linestring...

o wkx x 228,168 ops/sec ±2.49% (130 runs sampled)
o terraformer x 119,201 ops/sec ±2.00% (134 runs sampled)

Fastest: wkx
Slowest: terraformer

---

Benchmarks for: points...

o wkx x 487,693 ops/sec ±2.24% (130 runs sampled)
o terraformer x 167,483 ops/sec ±1.47% (137 runs sampled)

Fastest: wkx
Slowest: terraformer

---
All benchmarks finished.

@sushantdhiman
sushantdhiman merged commit 4c7b103 into master Jun 16, 2018
@sushantdhiman
sushantdhiman deleted the use-wkx branch June 16, 2018 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant