Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] AVL tree + performance tweaking #42

Merged
merged 44 commits into from
Jan 1, 2018
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
a05acd2
added the AVL tree to the tests \#17
w8r Aug 23, 2017
f477987
First pass at integrating avl
rowanwins Aug 30, 2017
873ca52
Updates
rowanwins Aug 30, 2017
8630459
tests are passing, demos work
w8r Aug 30, 2017
a1fd1b4
Potential fix
rowanwins Sep 5, 2017
117118d
Add benchmark tests
rowanwins Sep 5, 2017
3e0982b
performance tweaking, splitting the code up
w8r Sep 6, 2017
916c8b0
made tests pass
w8r Sep 14, 2017
7f0a6bf
made eslint happy
w8r Sep 14, 2017
25054c1
Performance Fix
rowanwins Sep 25, 2017
a791d09
Performance tweak based on https://jsperf.com/andcomparitor/1
rowanwins Sep 25, 2017
6dbfa39
Add new style of test
rowanwins Oct 23, 2017
b984309
Fix multipoly input
rowanwins Oct 23, 2017
608b6aa
Add multipoly checks
rowanwins Oct 23, 2017
1446e58
Add check for outgoing poly.
rowanwins Oct 24, 2017
ced574b
Fix union operation with hole
rowanwins Oct 24, 2017
794e609
This could be it....
rowanwins Oct 24, 2017
57b1b5e
removed breaking line again
w8r Oct 24, 2017
281b047
test case for #43
w8r Oct 25, 2017
60a5614
Another fix
Oct 26, 2017
41a8cfd
Fix render
rowanwins Oct 26, 2017
1bb3c2c
Add visual debug
rowanwins Oct 29, 2017
4c89c2d
Fix linting
rowanwins Oct 29, 2017
70a619f
Fix for difference. Fixes #holecut difference operation.
rowanwins Dec 3, 2017
bf566d9
Partial fix for overlapping edges...
rowanwins Dec 3, 2017
9cac378
new test cases
w8r Dec 4, 2017
1f06498
attempts
w8r Dec 4, 2017
9160a2c
Clone overlapping segments
rowanwins Dec 6, 2017
fdfa30a
And again
rowanwins Dec 11, 2017
66bbb76
fixed
w8r Dec 14, 2017
4b65cf1
Merge branch 'rowanwins-avl-again' of https://github.com/w8r/martinez…
w8r Dec 14, 2017
809211e
proper cloning
w8r Dec 14, 2017
5755f87
fixed
w8r Dec 14, 2017
5e6b8b4
just threw away code
w8r Dec 17, 2017
323f9cb
that fixed difference in #holecut
w8r Dec 17, 2017
12c95fb
removed console.log
w8r Dec 18, 2017
c08251a
Update tinyqueue for performance improvement
rowanwins Dec 20, 2017
24c5918
cleanup
w8r Dec 20, 2017
998f291
debug files
w8r Dec 20, 2017
11236ea
Fix for #holecut difference nesting
rowanwins Dec 20, 2017
9488ee3
merge changes
rowanwins Dec 20, 2017
c7ec961
Fluke fix?
rowanwins Dec 20, 2017
e2de512
added test for #47
w8r Dec 20, 2017
9a9e1c1
filtered out collapsed edges
w8r Jan 1, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions bench.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const path = require('path');
const load = require('load-json-file');
const Benchmark = require('benchmark');
const jstsUnion = require('@turf/union');
const fs = require('fs');
const martinez = require('./src/index');


/**
* Benmark Results
*
* Hole_Hole x 13,345 ops/sec ±2.13% (91 runs sampled)
* Hole_Hole - JSTS x 1,724 ops/sec ±4.80% (87 runs sampled)
* Asia x 6.32 ops/sec ±3.16% (20 runs sampled)
* Asia - JSTS x 6.62 ops/sec ±2.74% (21 runs sampled)
*/

const options = {
onStart (event) { console.log(this.name); },
onError (event) { console.log(event.target.error); },
onCycle (event) { console.log(String(event.target)); },
onComplete() {
console.log('- Fastest is ' + this.filter('fastest').map('name') + '\n');
}
};

const hole_hole = load.sync('./test/fixtures/hole_hole.geojson')
new Benchmark.Suite('Hole_Hole', options)
.add('Martinez', () => {
martinez.union(
hole_hole.features[0].geometry.coordinates,
hole_hole.features[1].geometry.coordinates);
})
.add('JSTS', () => {
jstsUnion(hole_hole.features[0], hole_hole.features[1]);
})
.run();

const asia = load.sync('./test/fixtures/asia.geojson');
const unionPoly = load.sync('./test/fixtures/asia_unionPoly.geojson');
new Benchmark.Suite('Asia union', options)
.add('Martinez', () => {
martinez.union(
asia.features[0].geometry.coordinates,
unionPoly.geometry.coordinates);
})
.add('JSTS', () => jstsUnion(asia.features[0], unionPoly))
.run();
12 changes: 8 additions & 4 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>Martinez Clipping</title>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.0-rc.2/leaflet.css">
<!-- <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.0-rc.2/leaflet.css"> -->
<link rel="stylesheet" type="text/css" href="../node_modules/leaflet/dist/leaflet.css">

<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jsts/1.2.0/jsts.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.0-rc.2/leaflet.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/leaflet-editable/0.7.0-beta.1/Leaflet.Editable.min.js"></script>
<!-- <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jsts/1.2.0/jsts.min.js"></script> -->
<script type="text/javascript" src="../node_modules/jsts/dist/jsts.min.js"></script>
<!-- <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.0-rc.2/leaflet.js"></script> -->
<script type="text/javascript" src="../node_modules/leaflet/dist/leaflet.js"></script>
<!-- <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/leaflet-editable/0.7.0-beta.1/Leaflet.Editable.min.js"></script> -->
<script type="text/javascript" src="../node_modules/leaflet-editable/src/Leaflet.Editable.js"></script>
<link rel="stylesheet" href="css/styles.css">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

Expand Down
Loading