Skip to content

trailview: the stamp worker keeps less for each feature tile - #3802

Open
timohueser wants to merge 2 commits into
developfrom
claude/trailview-3793-stamp-tiles
Open

timohueser wants to merge 2 commits into
developfrom
claude/trailview-3793-stamp-tiles

Conversation

@timohueser

@timohueser timohueser commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Mode: change #3793
Requirements: none
Public docs: no

Closes #3793. Part of #3656.

What changed

All in terrain/bins.ts, under builder/web/src/lib/trailview/:

  • Shapes carries the tile's zoom. The grids of a tile's index (tileIndex, deckIndex) have cells of the larger of 2^13 world units and the tile's size / 16. A zoom 13 tile keeps its cells. A zoom 8 tile has 16 × 16 cells in place of 512 × 512, so the box of a long river no longer fills thousands of cells.
  • linesShow(level): whether any line can show at a level, from the reach limit of shows, which shows now shares. It is false at level 12 and coarser.
  • nodeStamps: a node at a level where no line shows writes no junction and no corner records. The shader draws nothing from them there: it skips a corner whose road does not show, and a junction's reach is below 0.
  • features: a tile under zoom 13 whose nodes show no line (zoom 11 and coarser) keeps only its RIVER, STREAM, BRIDGE and TUNNEL lines: the water mesh draws the rivers and streams and lifts them under a bridge, and portalBoxes reads the tunnels.

Tests: the linesNear test runs on a zoom 13 and a zoom 8 tile. A new test holds that shows is false for every profile wherever linesShow is false, that this is level 12 and coarser, and that a motorway shows at level 13. A new test holds that a zoom 10 fixture tile keeps only those four kinds and a zoom 12 tile keeps its roads, and that a level 12 node writes no junction or corner record while the level 14 nodes of the same tile do. kind.test.ts and cores.test.ts give their hand-made Shapes a zoom.

Checks

In builder/web:

  • npx vitest run src/lib/trailview: 71 files, 501 tests pass.
  • npm run check: 0 errors, 0 warnings.
  • cairn check: no new violations. obc prose --check: pass.

Replay (M1 Pro, the method of the comment on #3793): the recorded messages of the walk (243 jobs) and the valley drive to and fro twice (1,011 jobs), at tier=phone, fed one at a time to the built stamp worker in the JavaScriptCore shell of macOS.

develop this change
Live heap peak, walk 209 MiB 48 MiB
Live heap peak, drive 197 MiB 54 MiB
Jobs of zoom 12 and 13 tiles whose result differs – 0 of 1,121
Jobs of zoom 8 to 11 tiles whose result differs – 116 of 133: the stamp data, without the junction and corner records
All job times, walk (two runs) 3.3, 3.2 s 1.8, 1.7 s
All job times, drive (two runs) 4.0, 4.2 s 2.6, 2.6 s
Zoom 13 stamp jobs, drive (five runs) 1.33 to 1.40 s 1.24 to 1.41 s

Far views (headless Chromium on Metal, 390 × 844 CSS pixels at DPR 2, the release data of Central Switzerland): the start of the four kit scenes and the two far views of the epic's galleries, develop and this change, at both tiers. The renderer is not exact from run to run, so develop also ran twice. Pixels that differ in any channel, and by more than 8/255:

View develop, twice (desktop) develop / change (desktop) develop, twice (phone) develop / change (phone)
walk 2, 0 2, 0 – 0, 0
valley-drive 22, 0 21, 0 – 100, 0
zoom-out 73, 0 64, 0 232, 0 92 and 278, 0
bridge-tunnel 3,088, 815 2,810, 889 – 2,925, 948
far-north 1,346, 0 460, 0 3,788, 0 337 and 285, 0
far-south 1,051, 0 849, 0 231, 0 1,117 and 418, 0

Two runs of the same build move up to 3,788 pixels, each by at most 8/255 (the change against itself on far-south, phone: 860). The change moves pixels within that range and by no more than 8/255, so no gallery is needed. The bridge-tunnel view moves about 800 pixels by more than 8/255 in every pair, develop against develop too.

Review

One review round (opus, high). Fixed: no test pinned the boundary between zoom 11 and zoom 12, where a wrong filter would remove the roads that level 13 draws; and the constant of the kept kinds named the water mesh as the reader of the tunnels. Checked and sound: featureTile maps each coarse tile to one level; the dropped junction records only set the shelf share, which only road segments read; the water ribbons keep their order; floors, structure meshes and road meshes read zoom 13 only; audit.wgsl already skipped the coarse road samples.

Phone (owner)

The phone check runs on the iPhone 13 with the app host of prototype/trailview-ios-app, at tier=phone:

  1. p-end-stamp: the stamp worker gives back at most 112 MiB (it gave back 192 MiB in TrailView phone tier: smaller caches and fewer workers #3778).
  2. p-soak: the 10-minute drive ends with at least 512 MiB of headroom (416 MiB in TrailView phone tier: smaller caches and fewer workers #3778).

RESULTS PENDING

🤖 Generated with Claude Code

The cells of a tile's index grow with the tile, to at most 16 × 16 across
it; a zoom 13 tile keeps its cells. At a level where no line shows (12 and
coarser), a node writes no junction or corner records, and its tile keeps
only the lines of the water mesh. In a replay of the walk in WebKit's
engine, the stamp worker's peak falls from 209 to 48 MiB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 51 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e482f75a-87f7-48cd-b07f-215d5ab03bf2
Commits

Reviewing files that changed from the base of the PR and between 447fa75 and 3c4ea03.

Files selected for processing: 4

  • builder/web/src/lib/trailview/kinds/kind.test.ts
  • builder/web/src/lib/trailview/roads/cores.test.ts
  • builder/web/src/lib/trailview/terrain/bins.test.ts
  • builder/web/src/lib/trailview/terrain/bins.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

The tests pin the boundary: no line shows at level 12 and coarser, a
motorway shows at level 13, and a zoom 12 tile keeps its roads. The kinds
that a coarse tile keeps say which reader needs each one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@timohueser
timohueser marked this pull request as ready for review November 22, 2026 00:59

This branch has not been deployed

No deployments
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.

TrailView phone tier: the stamp worker keeps less for each feature tile

1 participant