Skip to content

Comments

perf(core): optimize agent hot path across 9 subsystems#669

Merged
bug-ops merged 2 commits intomainfrom
feat/agent-hot-path-optimization
Feb 19, 2026
Merged

perf(core): optimize agent hot path across 9 subsystems#669
bug-ops merged 2 commits intomainfrom
feat/agent-hot-path-optimization

Conversation

@bug-ops
Copy link
Owner

@bug-ops bug-ops commented Feb 19, 2026

Summary

Resolves #621 — optimize the core agent loop by eliminating unnecessary allocations, O(n) scans, and blocking operations across 9 targeted subsystems.

10 files changed, +198 -84, 6 new tests (2017 total passing).

Test plan

  • cargo +nightly fmt --check passes
  • cargo clippy --workspace -- -D warnings passes (0 warnings)
  • cargo nextest run --workspace --lib --bins — 2017 passed, 9 skipped
  • WAL journal_mode assertion with tempfile-based DB
  • doom-loop hash equality/inequality tests on Vec<u64> path
  • detect_image_mime mixed-case extension tests
  • format_tool_output structure tests

- Enable SQLite WAL mode with SYNCHRONOUS=NORMAL (#639)
- Replace O(n*iterations) token scan with cached_prompt_tokens (#640)
- Defer maybe_redact to stream completion boundary (#641)
- Replace format_tool_output allocation with Write-into-buffer (#642)
- Change ToolCall.params from HashMap to serde_json::Map (#643)
- Pre-join static system prompt sections into LazyLock (#644)
- Replace doom-loop string storage with content hash (#645)
- Return &'static str from detect_image_mime (#646)
- Replace block_on in history persist with async spawn (#647)
@bug-ops bug-ops force-pushed the feat/agent-hot-path-optimization branch from 7552418 to 753c1a8 Compare February 19, 2026 23:09
@bug-ops bug-ops enabled auto-merge (squash) February 19, 2026 23:09
@bug-ops bug-ops merged commit 8e16712 into main Feb 19, 2026
20 checks passed
@bug-ops bug-ops deleted the feat/agent-hot-path-optimization branch February 19, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment