Closed mbostock closed 6 years ago
A subtle point to highlight: Delaunator.from generates a Float64Array for coords
rather than the (untyped) Array previously used by new Delaunator. If that’s not desired for some reason, I’m happy to revert that back to a plain Array.
This is exactly how I would implement it after looking at d3-delaunay
. Thanks a lot for the PR 👍
Re Float64Array
— previously benchmarks showed that performance doesn't noticeably differ from simply using an array and letting V8 figure out the best way to represent it internally. However I'm now seeing an obvious improvement (about 13%) on Node v8 and v9 — perhaps related to changes after transition from Crankshaft to TurboFan.
This replaces the constructor(points[, getX, getY]) with a faster constructor that takes a pre-built flat array [x0, y0, x1, y1, …]. The slow constructor is now available as Delaunator.from.
This will require a major version bump to 2.0. Fixes #17.