Conversation
エージェント高頻度出力時に CPU を恒常消費していた 3 つの描画ホット パスを差分化・コアレス・キャッシュで削減する。 - 没入 drive: 出力起因の再描画を最小フレーム間隔 (16ms) でコアレス。 対話起因 (入力エコー・resize・選択・hover・badge) は即時描画を維持。 wait に再描画デッドラインを渡し busy-loop を避ける。 - リンク全走査: link_cells の結果を generation でキャッシュし、画面 内容が変わらない限り再検出しない。TerminalView に precomputed links を受け取る from_screen_with_links を追加 (既存経路は委譲で無改変)。 - Switch プレビュー: pool.snapshot に dir/geo/generation のキャッシュ を持たせ、未変化なら resize ioctl も from_screen も行わず再利用する。 描画結果は従来どおり。terminal_pane/terminal_pool はカバレッジ除外、 terminal_view の新メソッドは単体テストを追加。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📊 Test Coverage
🎉✨ パーフェクト!全ファイル Lines カバレッジ 100% を達成しました 🏆🐰 |
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.
目的
コードレビュー (#65) で判明した、エージェント高頻度出力時の CPU 消費・応答性に直結する描画ホットパス 3 件を解消する。観測される描画結果は従来どおりのまま、変化がない限り重い処理(パーサーロック・全グリッド文字列化・TIOCSWINSZ ioctl)を行わないようにする。
変更内容
① 高頻度出力時の再描画コアレス(
terminal_pane.rs)driveが毎回フル再描画していた。MIN_FRAME=16ms(≒60fps) でコアレス。対話起因は即時描画で応答性を維持。waitにredraw_deadlineを渡し、保留出力をデッドラインまで持ち越して busy-loop を回避(入力は常に即時)。② リンク全走査のキャッシュ(
terminal_view.rs+drive)link_cells(screen)が全論理行を平坦化しHashSet<Cell>を再構築していた。TerminalView::from_screen_with_linksを追加し、precomputed links を受け取れるようにした(既存from_screen_with_selectionはlink_cellsを呼んでこれに委譲、既存経路・テスト・snapshot は無改変)。drive側で links を generation でキャッシュ。画面内容が変わらない限り再検出せず、ホバーのみのフレームは再走査しない。③ Switch プレビューの差分化(
terminal_pool.rs)snapshotが毎反復で無条件にsession.resize+from_screenを実行していた。preview_cache(dir / geo / generation / view)を追加。3 つすべて一致ならキャッシュした view を返却(パーサーロックすら取らない)。dir/geo 変化時のみresize、generation 変化時のみfrom_screen。没入driveのlast_geo差分化と同等の挙動に揃えた。テスト・確認方法
cargo fmt/cargo clippy --all-targets -- -D warnings/cargo test(1376 passed)。terminal_pane.rs/terminal_pool.rsは端末 I/O のためカバレッジ除外。terminal_view.rsの新メソッドには単体テストを追加)。🤖 Generated with Claude Code