Repository navigation
perf: Windows/macOSでのエミュレーション速度不足と描画スキップを解消 - #1
Merged
Merged
Conversation
同じBubiBoy Lite移植の姉妹プロジェクトharegirl(Hare言語)の高速化 コミットを監査し、RuxBoyに取り込めるものを移植した。ROM/RAMバンク数は 仕様上常に2の冪であるにもかかわらず、CPU全命令のオペコードフェッチを 含む最も熱いパスであるNormalizedRomBank/NormalizedRamBankが剰余演算 (bank % count)でバンクを折り返していたため、bank & (count - 1)へ 置き換えた。 APUのチャンネル周期タイマーを閉じた式(O(1))化する対策も試作したが、 CpuPerfベンチで221-227%→216-221%realtimeの退行を実測したため差し戻した (RuxBoyはBusTickを4/8 T-cycle単位でしか呼ばず、haregirlのように HALT待ちを一括バッチしないため、除算コストが短いインラインループを 上回った)。経緯・却下理由の一覧はdocs/PerformanceNotes.md 7章、 docs/DevelopmentNotes.mdに記録。 scripts/test.sh --release 全PASS(既知の3件のexpected-failのみ、差分なし)。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016LsgvHbRrFDtbYJqpaCQh3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Frame skips on M4 came from a shallow audio queue, not emulation speed (~6ms/frame). Prefill silence up to the pacing target at startup and request 512 sample frames on macOS so CoreAudio drains in smaller steps. Dragon Quest III: 0 skipped frames in 3x60s windowed runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Defer Timer/PPU/DMA updates until the next event time or an I/O access instead of ticking them on every CPU memory access. Dispatch opcodes with a bit-field decision tree, read ROM/WRAM/HRAM directly via cached bank windows, run frames through CpuRun, and split/unroll the scanline renderer with a cached ARGB palette. Dragon Quest III headless 1800 frames: 119.6G -> 43.5G instructions retired, identical framebuffer hash. All tests unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Windows (D3D11) the 4th-5th SDL_RenderPresent after the window is shown took ~75ms in total, exhausting the ~66ms silence prefill and causing 1-2 skipped frames right after startup. Present a black frame 10 times before AudioInit so the stall happens before audio playback. Dragon Quest III opening: 0 skipped frames in 5 startups and 3x60s runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
概要
Dragon Quest III (GBC) を対象に、エミュレーション本体の高速化と、オーディオ駆動ペーシングまわりの描画スキップ対策を行った。
主な変更
CpuRunで回すbuild_macos.shで pkg-config が SDL3 を見つけられないときbrew --prefixにフォールバックする結果
詳細は
docs/PerformanceNotes.mdの 19・20 章以降を参照。🤖 Generated with Claude Code