Skip to content

perf(pmtiles): compress the leaf directories on all cores - #990

Open
dktue wants to merge 1 commit into
systemed:masterfrom
dktue:perf/pmtiles-close-parallel
Open

dktue wants to merge 1 commit into
systemed:masterfrom
dktue:perf/pmtiles-close-parallel

Conversation

@dktue

@dktue dktue commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Gain: planet (in memory, 96 threads) "Closing pmtiles file" 9 s → 3 s (−6 s wall). Output byte-identical.

PMTiles::close built the directories and, every time a leaf directory reached 10M entries, serialized it, gzipped it and wrote it. All of that ran on one thread, about 9 s for the planet's ~15 leaves.

Now close first collects the entries and cuts them into leaves exactly as before: same run-length encoding, same cut points, same root entries for z0–z5. Then it serializes and compresses the leaves on all cores, and writes them in order. appendTileEntry and flushEntries are no longer needed.

Measurements

"Closing pmtiles file" (planet, 96 threads)
before 9 s at 1 thread
after 3 s

.pmtiles output byte-identical (Germany at 32 and 8 threads, Chilean fjords extract; with #981/#942/#983 for deterministic output).

🤖 Generated with Claude Code

PMTiles::close serialized and gzipped the leaf directories (up to 10M
entries each) one after the other while building them: ~9 s for the
planet on one thread. Now it first collects the entries and cuts them into
leaves exactly as before, then serializes and compresses the leaves in
parallel, and writes them in order. The file is byte-identical.

Planet (in memory, 96 threads): "Closing pmtiles file" 9 s -> 3 s.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
cldellow added a commit to cldellow/tilemaker that referenced this pull request Nov 8, 2026
relslow-patched: port upstream systemed#989 and systemed#990 (dktue)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant