Skip to content

Store large circle sets by place, so a zoomed-in tile reads only the pages round it - #43

Merged
wf9a5m75 merged 1 commit into
developfrom
feat/spatial-circle-blocks
Nov 13, 2026
Merged

wf9a5m75 merged 1 commit into
developfrom
feat/spatial-circle-blocks

Conversation

@wf9a5m75

Copy link
Copy Markdown
Contributor

The same change as MapConductor/js-sdk-core#48 and MapConductor/android-sdk-core#46, for iOS. It's a draft because it made no measurable difference on a device.

Change

  • CircleTileSet writes the geometry file in Z-order of each circle's z12 cell, using a stable radix sort of 24-bit keys. The key is the same as on the web and Android.
  • Indices stay the list's: CircleGeometryFile.record(at:) translates them.
  • The passes over every shape (the grid index build and the widest stroke) walk the storage order.
  • Compaction keeps the order.

Tests: CircleGeometryFileOrderTests

  • Reads by index, bounds and the index's answers are the same as index order.
  • Tiles are byte-identical to index order on the GPU and on the CPU.
  • The sort is stable.

All 560 core tests pass on the simulator.

Measured on an iPad Pro 11" (2018): 9 tiles from the real antenna set (723,800 circles), two rounds each.

9 tiles List order By place
NYC z8 36 ms 35 ms
NYC z12 61–62 ms 64–70 ms
NYC z14 75–80 ms 81–83 ms
Chicago z12 39 ms 38–41 ms

No difference. The file is memory-mapped, and its 72 MB stay in the page cache, so the record order doesn't matter. It would only matter if the system evicted those pages under memory pressure, and I didn't measure that.

…pages round it

The circle geometry file kept its records in list order, so a tile's circles lay
all over the mapping. CircleTileSet now writes it in Z-order of each circle's z12
cell (a stable radix sort of 24-bit keys, the same key as js-sdk-core and
android-sdk-core). Indices stay the list's: CircleGeometryFile translates them in
record(at:), and the passes over every shape (the grid index, the widest stroke)
walk the storage order. Compaction keeps the order. Tiles are byte-identical to
index order on the GPU and the CPU.
@wf9a5m75
wf9a5m75 marked this pull request as ready for review November 13, 2026 08:40
@wf9a5m75
wf9a5m75 merged commit c85697f into develop Nov 13, 2026
2 checks passed
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