perf(client): FPS cap, idle map chunks, concurrent prefetch (#20) - #362
Open
Aduersarius wants to merge 1 commit into
Open
perf(client): FPS cap, idle map chunks, concurrent prefetch (#20)#362Aduersarius wants to merge 1 commit into
Aduersarius wants to merge 1 commit into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 whennavigator.connection.saveDataorlocalStorage openao.perf.batterySaver=1.requestIdleCallbackrow chunks (10 rows). On low-end devices (deviceMemory≤4orhardwareConcurrency≤4), layers 3/4 + objects only instantiate within a 12-tile radius of the initial window.saveData/2g/slow-2g; cap to 2 maps with a real concurrency pool of 2 (not just serial.slice(0,2)).app.renderer.resolution(HiDPI crisp).frontend/lib/clientPerf.ts, unit tests, andfrontend/scripts/measure-client-perf.mjsbefore/after estimates.Measurement (
node frontend/scripts/measure-client-perf.mjs)Differentiation vs competing PRs
useGameSession/ server idle-CGNAT kitchen-sink noise; includes deferred chunking + low-end radius + battery saver; tests.clientPerfmodule with unit tests + measurement script; concurrent (not only sliced) prefetch; batterySaver FPS path; English-scoped PR body.Test plan
cd frontend && npx tsx --test lib/clientPerf.test.ts(8/8)node frontend/scripts/measure-client-perf.mjssaveData/ DevTools Network → prefetch skipped