Skip to content

Commit 632c700

Browse files
committed
Merge branch 'master' of https://github.com/w8r/martinez
2 parents 7284059 + cef5b3e commit 632c700

File tree

82 files changed

+6417
-9246
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+6417
-9246
lines changed

.eslintrc

Lines changed: 0 additions & 215 deletions
This file was deleted.

.github/workflows/nodejs.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,24 @@ name: Node.js CI
55

66
on:
77
push:
8-
branches: [ master ]
8+
branches: [master]
99
pull_request:
10-
branches: [ master ]
10+
branches: [master]
1111

1212
jobs:
1313
build:
14-
1514
runs-on: ubuntu-latest
1615

1716
strategy:
1817
matrix:
19-
node-version: [10.x, 12.x]
18+
node-version: [18.x, 20.x]
2019

2120
steps:
22-
- uses: actions/checkout@v2
23-
- name: Use Node.js ${{ matrix.node-version }}
24-
uses: actions/setup-node@v1
25-
with:
26-
node-version: ${{ matrix.node-version }}
27-
- run: npm ci
28-
- run: npm run build --if-present
29-
- run: npm test
21+
- uses: actions/checkout@v2
22+
- name: Use Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v1
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
- run: npm ci
27+
- run: npm run build --if-present
28+
- run: npm test

.github/workflows/publish.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
on:
22
push:
33
tags:
4-
- 'v*.*.*'
4+
- "v*.*.*"
55

66
jobs:
77
publish:
8-
98
runs-on: ubuntu-latest
109

1110
steps:
1211
- uses: actions/checkout@v1
1312
- uses: actions/setup-node@v1
1413
with:
15-
node-version: 12
14+
node-version: 20
1615
- run: npm ci
1716
- run: npm run build
1817
- run: npm test

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
registry=https://registry.npmjs.org/

bench.js

Lines changed: 0 additions & 58 deletions
This file was deleted.

bench/martinez.bench.ts

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import { describe, bench } from 'vitest';
2+
import { readFileSync } from 'fs';
3+
import { join } from 'path';
4+
import jstsUnion from '@turf/union';
5+
import * as martinez from '../index';
6+
7+
/**
8+
* Benchmark Results
9+
*
10+
* Previous results with Benchmark.js:
11+
* Hole_Hole x 13,345 ops/sec ±2.13% (91 runs sampled)
12+
* Hole_Hole - JSTS x 1,724 ops/sec ±4.80% (87 runs sampled)
13+
* Asia x 6.32 ops/sec ±3.16% (20 runs sampled)
14+
* Asia - JSTS x 6.62 ops/sec ±2.74% (21 runs sampled)
15+
*/
16+
17+
// Helper to load JSON files
18+
const loadJSON = (filePath: string) => JSON.parse(readFileSync(filePath, 'utf-8'));
19+
20+
// Load test fixtures
21+
const hole_hole = loadJSON(join(__dirname, '../test/fixtures/hole_hole.geojson'));
22+
const asia = loadJSON(join(__dirname, '../test/fixtures/asia.geojson'));
23+
const unionPoly = loadJSON(join(__dirname, '../test/fixtures/asia_unionPoly.geojson'));
24+
const states = loadJSON(join(__dirname, '../test/fixtures/states_source.geojson'));
25+
26+
describe('Hole_Hole union', () => {
27+
bench('Martinez', () => {
28+
martinez.union(
29+
hole_hole.features[0].geometry.coordinates,
30+
hole_hole.features[1].geometry.coordinates
31+
);
32+
});
33+
34+
bench('JSTS', () => {
35+
jstsUnion(hole_hole.features[0], hole_hole.features[1]);
36+
});
37+
});
38+
39+
describe('Asia union', () => {
40+
bench('Martinez', () => {
41+
martinez.union(
42+
asia.features[0].geometry.coordinates,
43+
unionPoly.geometry.coordinates
44+
);
45+
});
46+
47+
bench('JSTS', () => {
48+
jstsUnion(asia.features[0], unionPoly);
49+
});
50+
});
51+
52+
describe('States clip', () => {
53+
bench('Martinez', () => {
54+
martinez.union(
55+
states.features[0].geometry.coordinates,
56+
states.features[1].geometry.coordinates
57+
);
58+
});
59+
60+
bench('JSTS', () => {
61+
jstsUnion(states.features[0], states.features[1]);
62+
});
63+
});

0 commit comments

Comments
 (0)