earstrip beats earcut on 3.7M polygons
Original: Faster than earcut: triangulating 3.7M map polygons in 489 ms
Why This Matters
Drop-in speed gains for any web or native app rendering polygon-heavy maps.
Globus Software open-sourced earstrip, a C++ polygon triangulator that processes 3.7M map polygons in 489 ms—14% faster than earcut.hpp in C++ and up to 2.1× faster in the browser via WebAssembly.
Globus Software CEO Evgen Bodunov has published earstrip, a single C++ header library for polygon triangulation, under the ISC license. The library ships a WebAssembly build on npm with an API identical to earcut's, making it a drop-in replacement. The motivation was concrete: Globus's map engine previously relied on constrained Delaunay triangulation, which took 2.93 seconds on one M4 Pro core to triangulate the 3,740,425 polygons at zoom level 13 of its offline Masovian Voivodeship map. earstrip does the same job in 489 ms. The key insight Bodunov describes is that Delaunay's quality guarantees—maximizing the smallest angle across all triangles—are wasted on flat GPU fills, which render a needle-thin triangle just as correctly as a fat one. Nearly half the polygons in the dataset (1.8 million) have four vertices or fewer; the Delaunay code alone spent 419 ms on those simple shapes. earstrip switches to ear clipping instead, cutting off one corner at a time. The post walks through each algorithmic step as a separate timed commit, showing exactly where performance is gained. In browser benchmarks the WebAssembly build runs 1.4–2.1× faster than earcut.js.