Skip to content

Faster on phones: smaller tiles, leaner columns, quicker first load (#138) - #140

Merged
wcornwell merged 1 commit into
masterfrom
faster-tiles
Nov 12, 2026
Merged

wcornwell merged 1 commit into
masterfrom
faster-tiles

Conversation

@wcornwell

Copy link
Copy Markdown
Collaborator

Closes #138. Measurements and pilots are in the issue comments (findings, pilots).

Phone emulation showed that downloads, not processing, are the bottleneck, and that a small-area query used only 2–3% of the rows it downloaded.

Changes

Tiles (data-raw/build_tiles.R). The release files and the Shiny app are unchanged, and tiles are rebuilt from the release on every deploy.

  • 8,000 rows per tile instead of 60,000. Plantae goes from about 330 to about 2,000 tiles; the largest is about 0.5 MB.
  • Repository is stored as "" when it equals Link (iNaturalist records). toRecord() in web/js/data.js rebuilds it.
  • Collection Date is stored as a date, since the app only shows and exports dates (UTC). Tiles are sorted on the full timestamp before the time is dropped, so same-day records keep a deterministic order.

First load (web/index.html):

  • logo as WebP (63 → 15 KB), and a 64 px favicon instead of the 300 px PNG;
  • Google Analytics loaded 1.5 s after the page. Visits shorter than that aren't counted.
  • modulepreload for every app and hyparquet module, so they download at once. The list must be kept in sync; see web/vendor/README.md.

Coordinates are not rounded. They stay at full precision.

Results

Phone emulation: 4× slower CPU; 4G = 9 Mbps / 60 ms; slow 4G = 1.6 Mbps / 150 ms. Both versions use the same data, served gzipped like Pages.

4G Slow 4G
First load 2.1 → 1.4 s 7.7 → 4.7 s
Heron Island + Plantae 1.9 → 0.4 s 9.4 → 1.6 s
North Head + Plantae 2.1 → 0.5 s 10.3 → 2.4 s
Sydney 10 km circle + Plantae 6.2 → 2.1 s 32.4 → 10.3 s
  • Total tile data: 287 → 274 MB (v2.0.5 data).
  • The longest page freeze drops from 0.3–0.5 s to 0–0.2 s.

Checked

  • The tile build matches the pilot exactly: 1,751 Plantae tiles, 274.0 MB. The row-count check passes.
  • CSV downloads: Plantae for Heron, North Head, North Head + 1 km buffer and the Sydney 10 km circle contain the same rows as now. Only the row order differs, which was never defined. The stats sentence is identical.
  • Smoke test on the built site:
    • WebP logo loads, and analytics loads 1.5 s after the page;
    • popups, Show all records, KML upload and current location work;
    • the table shows "iNat";
    • no console errors.

🤖 Generated with Claude Code

…138)

Phone emulation showed downloads, not processing, are the bottleneck,
and that a small-area query used 2-3% of the rows it downloaded.

Tiles (data-raw/build_tiles.R; release files unchanged):
- 8,000 rows per tile instead of 60,000
- Repository stored as "" when it equals Link (iNaturalist records);
  rebuilt in toRecord() (web/js/data.js)
- Collection Date stored as a date; tiles are sorted on the full timestamp
  before the time is dropped

First load (web/index.html):
- logo as WebP (63 -> 15 KB), 64 px favicon instead of the 300 px PNG
- Google Analytics loaded 1.5 s after the page
- modulepreload for all app and hyparquet modules

Plantae on slow 4G: Heron Island 9.4 -> 1.6 s, North Head 10.3 -> 2.4 s,
Sydney 10 km circle 32.4 -> 10.3 s; first load 7.7 -> 4.7 s. CSV
downloads contain the same rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wcornwell
wcornwell merged commit 254dfbd into master Nov 12, 2026
6 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.

Measure and improve query speed on phones

1 participant