Skip to content

[codex] optimize PSP stats text rendering#19

Merged
doodlewind merged 1 commit into
mainfrom
synonymous-wind
Jul 5, 2026
Merged

[codex] optimize PSP stats text rendering#19
doodlewind merged 1 commit into
mainfrom
synonymous-wind

Conversation

@doodlewind

Copy link
Copy Markdown
Collaborator

Summary

Optimizes the stats demo text path on PSP by moving native glyph rendering from per-frame coverage-run rect generation to cached PSM_4444 font atlas textures, then drawing each glyph as a textured sprite.

Also reduces avoidable layout churn for changing text:

  • skips relayout when a text update measures to the same layout size;
  • quantizes the stats demo count-up text updates to every 8 frames;
  • adds scripts/bench-ppsspp.ts plus scripts/psp.ts --bench for repeatable PPSSPP timing runs.

Root Cause

The stats demo updates large numeric text every frame. On PSP this forced expensive text/layout work and the GE backend rebuilt anti-aliased glyphs by scanning coverage cells into many horizontal rect sprites each frame.

Benchmark

PPSSPP stats window, same input/window as PR #6 style benchmark:

  • before: avg_work_us=38449, avg_render_us=10138, avg_tick_us=15337
  • after: avg_work_us=16385, avg_render_us=1028, avg_tick_us=2666

Final 5-sample report: dist/bench/ppsspp-bench-2026-07-05T00-27-50-289Z.json locally.

Validation

  • git diff --check
  • bunx tsc --noEmit
  • bun run test
  • cargo test --manifest-path core/Cargo.toml
  • PSP_SDK=/Users/evan/code/dreamcart/mipsel-sony-psp E2E_PPSSPP_TIMEOUT=60 UPDATE=1 bun test/e2e-ppsspp.ts
  • PSP_SDK=/Users/evan/code/dreamcart/mipsel-sony-psp E2E_PPSSPP_TIMEOUT=60 bun test/e2e-ppsspp.ts
  • PSP_SDK=/Users/evan/code/dreamcart/mipsel-sony-psp BENCH_PPSSPP_TIMEOUT=60 bun scripts/bench-ppsspp.ts --apps=stats --samples=5 --timeout=60

Post-rebase smoke:

  • git diff --check
  • bunx tsc --noEmit && bun run test
  • PSP_SDK=/Users/evan/code/dreamcart/mipsel-sony-psp BENCH_PPSSPP_TIMEOUT=60 bun scripts/bench-ppsspp.ts --apps=stats --samples=1 --timeout=60

@doodlewind doodlewind merged commit 34f9238 into main Jul 5, 2026
@doodlewind doodlewind deleted the synonymous-wind branch July 5, 2026 00:34
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.

1 participant