-
Notifications
You must be signed in to change notification settings - Fork 942
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into spherical-calc-fixes
- Loading branch information
Showing
2 changed files
with
17 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
// I don't think this bench test does anything? There is no entry point into | ||
// the module called random() that takes a string? | ||
import Benchmark, { Event } from "benchmark"; | ||
import { randomPolygon } from "./index.js"; | ||
|
||
import { random } from "./index.js"; | ||
import Benchmark from "benchmark"; | ||
let totalTime = 0.0; | ||
const suite = new Benchmark.Suite("turf-random"); | ||
|
||
var suite = new Benchmark.Suite("turf-random"); | ||
suite | ||
.add("turf-random", function () { | ||
random("point"); | ||
}) | ||
.on("cycle", function (event) { | ||
console.log(String(event.target)); | ||
.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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters