Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
215 changes: 0 additions & 215 deletions .eslintrc

This file was deleted.

1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=https://registry.npmjs.org/
58 changes: 0 additions & 58 deletions bench.js

This file was deleted.

63 changes: 63 additions & 0 deletions bench/martinez.bench.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { describe, bench } from 'vitest';
import { readFileSync } from 'fs';
import { join } from 'path';
import jstsUnion from '@turf/union';
import * as martinez from '../index';

/**
* Benchmark Results
*
* Previous results with Benchmark.js:
* 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)
*/

// Helper to load JSON files
const loadJSON = (filePath: string) => JSON.parse(readFileSync(filePath, 'utf-8'));

// Load test fixtures
const hole_hole = loadJSON(join(__dirname, '../test/fixtures/hole_hole.geojson'));
const asia = loadJSON(join(__dirname, '../test/fixtures/asia.geojson'));
const unionPoly = loadJSON(join(__dirname, '../test/fixtures/asia_unionPoly.geojson'));
const states = loadJSON(join(__dirname, '../test/fixtures/states_source.geojson'));

describe('Hole_Hole union', () => {
bench('Martinez', () => {
martinez.union(
hole_hole.features[0].geometry.coordinates,
hole_hole.features[1].geometry.coordinates
);
});

bench('JSTS', () => {
jstsUnion(hole_hole.features[0], hole_hole.features[1]);
});
});

describe('Asia union', () => {
bench('Martinez', () => {
martinez.union(
asia.features[0].geometry.coordinates,
unionPoly.geometry.coordinates
);
});

bench('JSTS', () => {
jstsUnion(asia.features[0], unionPoly);
});
});

describe('States clip', () => {
bench('Martinez', () => {
martinez.union(
states.features[0].geometry.coordinates,
states.features[1].geometry.coordinates
);
});

bench('JSTS', () => {
jstsUnion(states.features[0], states.features[1]);
});
});
Loading