Skip to content

perf: publish the node/way stores' leftover groups from all threads - #989

Open
dktue wants to merge 1 commit into
systemed:masterfrom
dktue:perf/store-finalize-parallel
Open

dktue wants to merge 1 commit into
systemed:masterfrom
dktue:perf/store-finalize-parallel

Conversation

@dktue

@dktue dktue commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Gain: planet (in memory, 96 threads) −9 s wall: a ~10 s single-threaded gap after the ways pass is gone. Output identical.

At the end of the nodes and ways passes, SortedNodeStore::finalize and SortedWayStore::finalize publish the "orphan" groups one after the other. Those are the groups split between two worker batches; publishing means sort, encode and allocate. On the planet that took about 10 s after the ways pass, with every other thread idle (perf: SortedWayStore::finalize → publishGroup, malloc, sort, encodeWay).

The groups are independent, and publishGroup is what the worker threads already call concurrently during the pass: atomic counters, a mutex around the allocation list, thread-local scratch, one slot per group. So finalize now publishes them from threadNum threads. The store content is the same, only the order in which groups are published changes.

Measurements

Planet in memory, 96 threads, stack of all open performance PRs, 1-second CPU sampling around the end of the ways pass:

busy threads after the ways pass
before 1 thread for ~10 s (233–242 s)
after ≤ 1 s

Germany and a Chilean fjords extract: output byte-identical (with #981/#942/#983, which make the output deterministic).

🤖 Generated with Claude Code

At the end of the nodes and ways passes, SortedNodeStore/SortedWayStore::finalize
publish the "orphan" groups (groups split between worker batches) one after
the other: sort, encode, allocate. On the planet that took ~10 s after the
ways pass with every other thread idle. The groups are independent and
publishGroup is what the workers call concurrently during the pass, so
finalize now publishes them from threadNum threads. Same store content.

Planet (in memory, 96 threads): the ~10 s single-threaded gap after the ways
pass is gone (wall -9 s). Germany output identical.

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