Per-frame redraw and allocation hot spots (Siege, Maze, sfx noise, pad lookup, Runner HUD, popups, hub loop)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 30/100
- issue の種類
- リファクタリング
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- typescript, vite
- 領域
- game-dev, performance
調査の方向性
This is a bundle of seven separate performance items, so pick one and leave the rest. A good starting point is the Siege shield redraw in games/siege/scenes/GameScene.ts near lines 572-577, using the Maze wall drawing in games/maze/scenes/GameScene.ts (drawWalls) as the pattern. Done means that item is fixed or declined with a before-and-after Performance trace, and the other items are tracked separately.
索引モデルが issue の本文から書いたものです。
説明
Summary
A handful of avoidable per-frame costs outside the ones #35 and #37 already track. None is serious alone, but together they add main-thread work and garbage on low-end phones at 60 to 120 Hz. All costs below are estimates from reading the code; nothing was profiled.
Where and what
- Siege shields and Maze dots redrawn every frame.
games/siege/scenes/GameScene.ts:572-577clearsgfxand replays every shield cell as its ownfillRect(about 536 rects across 4 shields).games/maze/scenes/GameScene.ts:516-537does the same for every remaining dot (about 200fillStyle+fillRectpairs). Both only change on a hit or a dot eaten. Fix: draw them into their own Graphics (Maze already does this for walls indrawWalls) and redraw only when they change. -
noise()builds a new random AudioBuffer for every sound.shared/sfx.ts:52-66allocates and fills a buffer withMath.random()on each call. Astro calls it every 90 ms while thrusting (games/astro/scenes/GameScene.ts:246-249) and per rock; Runner every 90 ms while sliding (games/runner/scenes/GameScene.ts:284). That is roughly 170 KB/s of garbage while thrusting. Fix: create one 1 s noise buffer once and play slices withsrc.start(t, offset, duration). - Hub gamepad loop runs forever.
src/hub/navigation.ts:227-238reschedulesrequestAnimationFrame(poll)unconditionally, even with no gamepad, so the hub never goes idle (battery cost on phones). Fix: start ongamepadconnected(or at load if a pad is already connected) and stop once none remain, assrc/hub/pad-bindings.ts:83-101already does. -
ArcadeControls.padrebuilds and sorts the pad list 10 to 20 times a frame.shared/controls.ts:123-131runsgp.getAll().filter(...).sort(...)on every read, andrefresh()and the axis helpers read it repeatedly (shared/controls.ts:185-192,:205-208,:214-235). Fix: resolve the pad once at the top ofrefresh()and reuse it. - Runner re-renders its distance text almost every frame.
games/runner/scenes/GameScene.ts:523-532callsdistText.setTextfromupdate(), and at 380 to 920 px/s with 12 px per metre the value changes 32 to 77 times a second, each a canvas redraw and texture upload. Fix: use a BitmapText, or update at most every 100 ms. (Related: #36.) - Score popups create and destroy a blurred Text each time.
shared/ui.ts:34-47(floatText) makes a new Text with a 12 px shadow blur per popup; Breakout calls it per brick (games/breakout/scenes/GameScene.ts:329) and Astro per rock (games/astro/scenes/GameScene.ts:464), so multiball moments create several at once. Fix: pool a few popup Texts per scene, or use a BitmapText font. - Also worth adding to #35: Runner draws drones and the runner with
fillRoundedRect/strokeRoundedRectevery frame (games/runner/scenes/GameScene.ts:464-466,:505-507,:516-519).
Impact
Frame-time jitter and extra garbage collection on low-end mobile at the busiest moments, and an idle hub that keeps waking the CPU.
Acceptance criteria
- Each item fixed or explicitly declined, with a before/after Performance trace for the Siege/Maze and hub items.
Getting started
- Relevant files: listed above
- How to run tests:
npm test; profile with the browser's Performance panel onnpm run dev - Related: #35, #36, #37
Filed by repo-audit/full-audit at de2b25b. Severity: low. Effort: M. audit-key: performance|games/siege/scenes/GameScene.ts|render
- 主要言語
- TypeScript
- スター
- 3
- フォーク
- 3
- 平均マージ
- 10時間 22分
- マージ済み PR(30日)
- 6
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
TMHSDigital/GH-Arcade のほかの issue
-
good first issue performance severity: low
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
TMHSDigital/GH-Arcade#141 ·
メンテナーはふだん 1 日以内に返信
-
enhancement help wanted severity: low
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
TMHSDigital/GH-Arcade#139 ·
メンテナーはふだん 1 日以内に返信
-
enhancement help wanted severity: medium
難易度 4/5 3〜5日 初心者へのやさしさ 56/100
TMHSDigital/GH-Arcade#127 ·
メンテナーはふだん 1 日以内に返信
-
enhancement help wanted severity: medium
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
TMHSDigital/GH-Arcade#126 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
accessibility enhancement severity: low
難易度 4/5 3〜5日 初心者へのやさしさ 40/100
TMHSDigital/GH-Arcade#114 ·
メンテナーはふだん 1 日以内に返信
TMHSDigital/GH-Arcade の issue をすべて見る
似ている issue
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P3
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
openclaw/openclaw#203385 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
nwverse/persona#12800 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
メンテナーはふだん 1 日以内に返信
-
[MCP]: page snapshots in .playwright-mcp/ are not git-ignored (.playwright-cli/ is, since #42318)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
microsoft/playwright#44289 ·
メンテナーはふだん 1 日以内に返信
-
good first issue
難易度 2/5 半日 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信