Skip to content

W-073: demo-totalwar performance spike: confirm FPS tiers and soldier membership

Type: spike · Size: S · Epic: E-totalwar-m1 · Target: apps/demo-totalwar (Vitest bench, throwaway) · Breaking: no Depends: W-018, W-074 Refs: demo-totalwar brief §4 (entity budget), §5 (MemberOf row), §7 (performance targets), Notes (MemberOf and scale risks); concept §4 (koota relation cost); reference/koota (read-only)

Question / Timebox / Findings

Timebox: 2 hours, one session. Stop at the timebox and record what is known.

Constraints: Vitest bench only. No new dependencies (no bitECS). Koota public API only.

Questions: 1. Are the proposed FPS tiers realistic with koota and R3F instanced meshes? - 60 FPS at 20,000 soldiers (M1 playable target). - 30 FPS or more at 100,000 soldiers. - 1,000,000 soldiers: measured only, no target. - Note: a Vitest bench measures simulation tick time in node, not render FPS. Answer the tick-time part here, and say what is left for a browser run. 2. Is a MemberOf(regiment) relation fast enough for soldier membership at these scales? - If not, use a plain regiment ID field on each soldier instead. This fallback is the user's decision.

Findings: (none yet)

Steps

  • S1: read the koota relation and query code (read-only, reference/koota) and note relation cost per operation; files: none
  • S2: write a Vitest bench for soldier movement tick at 1,000, 20,000, 100,000, and 1,000,000 soldiers, with MemberOf membership and with a plain regiment ID field; files: apps/demo-totalwar/bench/membership.bench.ts
  • S3: record tick times, the FPS tier verdict per scale, and the membership decision in Findings; create follow-up items if needed (Triage); files: docs/work/W-073-demo-totalwar-perf-spike.md

Log

  • 2026-11-02 created (Triage) from user request; placed in Later because Depends W-018 is active, not done
  • 2026-11-02 W-018 done; Depends W-074 added (the bench file lives in the scaffolded app); ready check passed; moved Later -> Next (Triage). W-075 (spec) waits for this spike
  • 2026-11-02 moved up in Next to start the demo-totalwar path (Triage)