Skip to content

earstrip 0.3.0

Choose a tag to compare

@molind molind released this 22 Nov 11:15
· 2 commits to main since this release

On npm: earstrip@0.3.0.

Faster

  • The ear test checks two dents at a time with SSE2 on x86-64, NEON on arm64 and WebAssembly SIMD. The result is the same as that of the scalar loop, which EARSTRIP_NO_SIMD keeps.
  • A polygon with four holes or more joins them to the outer ring faster: each bridge passes over the boundary in blocks of 16 vertices.
  • The constrained triangulation writes its strips while it fills the polygon.

Changed

  • Polygons covered by the constrained triangulation get the same triangles in other strips, with about 4% more indices. Everything the ears cut comes out as in 0.2.0.
  • The npm package uses WebAssembly SIMD: Chrome and Edge 91, Firefox 89, Safari 16.4, Node 16.4 or later. Older engines get a module without SIMD, with the same results, after await ready. Bundlers that split chunks keep that module in a chunk of its own; without splitting both modules go into the bundle, 38 KB more with gzip.
  • The WebAssembly module grows from 68 to 77 KB, 27 to 28 KB with gzip; the one without SIMD is 74 KB.

Numbers

On 3.7 million map polygons earstrip is 31% faster than earcut.hpp in C++ (431 against 565 ms; 0.2.0 took 490), 1.6 (V8) and 1.75 (JavaScriptCore) times faster than earcut.js through the earcut-compatible call, and 1.9 and 2.3 times through the direct calls; on polygons with thousands of holes, 7 to 9 times. BENCHMARKS.md has every number of the run, and Checking the numbers the command for every row, on the polygons of the bench-data-1 release.