Skip to content

perf(client): FPS cap, idle map chunks, concurrent prefetch (#20) - #362

Open
Aduersarius wants to merge 1 commit into
Bitcoindefi:mainfrom
Aduersarius:feat/client-perf-20
Open

perf(client): FPS cap, idle map chunks, concurrent prefetch (#20)#362
Aduersarius wants to merge 1 commit into
Bitcoindefi:mainfrom
Aduersarius:feat/client-perf-20

Conversation

@Aduersarius

Copy link
Copy Markdown

Summary

Resolves #20 — client performance: memory spike from full-map sprites, uncapped FPS on high-refresh screens, and unbounded neighbor prefetch.

What landed

  • app.ticker.maxFPS: 60 by default; 30 when navigator.connection.saveData or localStorage openao.perf.batterySaver=1.
  • Deferred map fill: after the visible 21×21 window, remaining tiles render in requestIdleCallback row chunks (10 rows). On low-end devices (deviceMemory≤4 or hardwareConcurrency≤4), layers 3/4 + objects only instantiate within a 12-tile radius of the initial window.
  • Neighbor prefetch: skip on saveData / 2g / slow-2g; cap to 2 maps with a real concurrency pool of 2 (not just serial .slice(0,2)).
  • HUD text: FPS/ping/seguro texts use app.renderer.resolution (HiDPI crisp).
  • Evidence: pure helpers in frontend/lib/clientPerf.ts, unit tests, and frontend/scripts/measure-client-perf.mjs before/after estimates.

Measurement (node frontend/scripts/measure-client-perf.mjs)

  • Prefetch footprint city/8 exits → capped/2: ~10.9 MB → ~2.73 MB (−75%)
  • GPU frames on 120 Hz → 60 cap: −50%

Differentiation vs competing PRs

Test plan

  • cd frontend && npx tsx --test lib/clientPerf.test.ts (8/8)
  • node frontend/scripts/measure-client-perf.mjs
  • Manual: 120 Hz display — FPS HUD stays ≤60
  • Manual: saveData / DevTools Network → prefetch skipped
  • Manual: city map load — deferred chunks idle; low-end radius skips far roofs

…efi#20)

Cap ticker FPS (60, or 30 with saveData/batterySaver), finish deferred
map fill in requestIdleCallback row chunks with a low-end upper-layer
radius, limit neighbor prefetch to 2 concurrent downloads (skip on
saveData/2g), and match HUD text resolution to the renderer. Pure
helpers + unit tests + before/after measurement script.
@gitar-bot

gitar-bot Bot commented Sep 6, 2026

Copy link
Copy Markdown

Important

You are using the Gitar free plan. Upgrade to unlock code review, CI analysis, auto-apply, custom automations, and more.

Gitar

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.

Rendimiento del cliente: mapa completo en memoria, sin limite de FPS y prefetch sin tope

1 participant