mirror of
https://github.com/Turfjs/turf.git
synced 2026-01-25 16:07:00 +00:00
* @typescript-eslint/ban-types * @typescript-eslint/no-empty-function * @typescript-eslint/no-inferrable-types * @typescript-eslint/no-this-alias * no-case-declarations * no-cond-assign * no-dupe-else-if * no-empty * no-explicit-any * no-prototype-builtins * no-undef * no-unreachable * no-useless-escape * prefer-spread * comment the eslintrc * Almost had it * clearly my js trivia is not good enough today Co-authored-by: Matt Fedderly <mfedderly@palantir.com>
24 lines
752 B
JavaScript
Executable File
24 lines
752 B
JavaScript
Executable File
const path = require("path");
|
|
const glob = require("glob");
|
|
const Benchmark = require("benchmark");
|
|
const load = require("load-json-file");
|
|
const isClockwise = require("./index").default;
|
|
|
|
/**
|
|
* Benchmark Results
|
|
*
|
|
* counter-clockwise-line x 7,272,353 ops/sec ±11.64% (58 runs sampled)
|
|
* clockwise-line x 10,724,102 ops/sec ±2.19% (76 runs sampled)
|
|
*/
|
|
const suite = new Benchmark.Suite("turf-boolean-clockwise");
|
|
glob
|
|
.sync(path.join(__dirname, "test", "**", "*.geojson"))
|
|
.forEach((filepath) => {
|
|
const { name } = path.parse(filepath);
|
|
const geojson = load.sync(filepath);
|
|
const [feature] = geojson.features;
|
|
suite.add(name, () => isClockwise(feature));
|
|
});
|
|
|
|
suite.on("cycle", (e) => console.log(String(e.target))).run();
|