Repository navigation
tilemaker on the whole planet: from 2 h 10 min to under 24 minutes, and how you can help land it #977
Replies: 2 comments 7 replies
|
Very nice work! Is there a branch with all the PRs on it, or should I manually apply them for testing? I maintain a hobby project that renders North America using GitHub Actions. To fit within their runtime budget for free projects, I had to do some contortions -- sounds like those may all be non-issues now. (Lake Huron and some of the forests of the USA stand out in my memory as causes of grief, for example.) |
Update: the planet on ordinary machinesThe numbers above came from a 96-thread server. To see what this means for everyone else, we ran the full planet again on the same server, limited to what smaller machines have: CPUs pinned with
What this shows:
With 16 GB, only about 4 GB is left to cache the store next to tilemaker's 12 GB, so the 4-core machine reads a lot from disk and is slower than its core count alone would suggest (17 instead of 13 CPU-hours). It works, but 32 GB is where it gets comfortable. |


Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone 👋
In mid-October, building vector tiles for the whole planet with tilemaker took 2 hours 10 minutes on our test server. Today, with the changes that are merged plus the ones in review, the same build takes 23 minutes 34 seconds, uses 6.7× less CPU time and 109 GB less memory. The map is the same, except that some parks and lakes that
masterdrops are back (more on that below).We wanted to share where that came from, show what's already in
masterand what's still waiting in open PRs, and invite you to try it on your own data.The headline
mastertodaymaster+ open PRsSame machine, same planet file, same command for all three: OpenMapTiles profile with coastline and landcover shapefiles,
.pmtilesoutput, everything in memory, default thread count. AMD EPYC 9454P (48 cores / 96 threads), 503 GB RAM, Ubuntu 22.04, GCC 11.4. "Open PRs" means all open performance PRs together: #941, #943, #945, #949, #959, #961, #966, #968 and #970–#976. One run each; "Before #939" is the baseline run from #939 on the same planet file, the other two were run back to back today.Not just for big servers
Most people don't run tilemaker on a 96-thread machine, so here is Germany limited to 8 threads, roughly a normal desktop:
mastertodaymaster+ open PRs(Average of 2 interleaved rounds.)
And if your machine doesn't have much RAM: with
--store, Germany under an 8 GB memory limit went from "stopped after 69 minutes, unfinished" to 5 min 36 s (#943).Where the time went
mastermaster+ open PRsThe flat stretches where
masterwaits with 1–5 busy cores (shapefile loading, then a handful of giant relations) are gone, and tile writing takes half the time.Reading, relations, preparing and writing all got faster, not just one phase. The biggest jumps came from no longer doing expensive work that wasn't needed: proving that already-valid polygons are valid, clipping polygons with a general-purpose algorithm when a rectangle clip is exact, and letting single huge relations (Lake Huron, Lake Nasser, Guri Reservoir…) hold up the threads waiting behind them.
The biggest single wins
Each line shows the gain in the part the change targets, and what it did to the whole planet build.
--store65.7 → 49.1 min--store49.9 → 36.4 min--storerunsAnd some that matter a lot for specific setups:
combine_polygons_belowis about 4× faster (Luxembourg with OpenTopoMap 14.5 s → 5.8 s; the slowest single merge 9.9 s → 1.2 s).--storewhen RAM is tight: over 12× faster, 67× less disk writing, and the output now matches in-memory runs.Beyond speed
"tile_format": "mlt", about 12% smaller than MVT.std::terminateinto readable error messages, fixes musl/BSD/NetBSD builds, keeps roundabouts that used to disappear when simplified, and more.How we made sure the tiles are still right
Speed is worthless if the map changes. Every PR was checked with:
master. The pure speed changes give identical tiles.master. Polygons only come back: 13,526 polygon groups thatmasterdrops from z14 tiles (whole parks, lakes and landuse areas) return with @TimSC's Fix dropped polygons in scaleRing; skip distant shapefile records... #941 (scaleRingdropped rings starting with a duplicated vertex), and about 800 more with perf: exact rectangle clip for valid polygons (planet 25% faster, 31% less CPU) #949 (Boost's clip failed when a vertex lay exactly on the tile edge). The only losses are tiny simplification differences at z10–12, under one millionth of the polygon area.Try it, and help us land it
All of this is open source and ready for review. The fastest way to get it into a release is real-world testing:
master: time, memory, and whether your tiles look right.A big thank you to @systemed for maintaining tilemaker and for reviewing and merging #939, to @TimSC for #941, which the rectangle clip builds on, and to everyone who reported the issues these PRs fix. We know a pile of PRs takes time to review; there's no rush, and we're happy to split, rebase or explain anything.
What's next
--storewithout sharding is 16% faster; on small ones sharding wins. We'd like to discuss choosing this automatically.Happy tiling! 🗺️
The profiling, benchmarking and much of the code were done with the help of Claude Code; every number above comes from real runs on the hardware described.
All reactions