mirror of
https://github.com/Turfjs/turf.git
synced 2026-01-25 16:07:00 +00:00
Reversed the order in which random polygon points are generated to satisfy to the right hand rule for polygons. Added a simple benchmark test for turf-random.
17 lines
498 B
TypeScript
17 lines
498 B
TypeScript
import Benchmark, { Event } from "benchmark";
|
|
import { randomPolygon } from "./index.js";
|
|
|
|
let totalTime = 0.0;
|
|
const suite = new Benchmark.Suite("turf-random");
|
|
|
|
suite
|
|
.add("turf-random", () => randomPolygon(1, { num_vertices: 100000 }), {
|
|
onComplete: (e: Event) =>
|
|
(totalTime = totalTime += e.target.times?.elapsed),
|
|
})
|
|
.on("cycle", (e: Event) => console.log(String(e.target)))
|
|
.on("complete", () =>
|
|
console.log(`completed in ${totalTime.toFixed(2)} seconds`)
|
|
)
|
|
.run();
|