Skip to content

perf(tools): cache extracted string values in ToolCallDag to avoid double scan#1766

Merged
bug-ops merged 2 commits intomainfrom
perf-tools-cache-extracted-str
Mar 14, 2026
Merged

perf(tools): cache extracted string values in ToolCallDag to avoid double scan#1766
bug-ops merged 2 commits intomainfrom
perf-tools-cache-extracted-str

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 14, 2026

Summary

  • Adds string_values: Vec<Vec<String>> field to ToolCallDag, populated once in build() by reusing the extract_string_values traversal that already runs there.
  • Exposes cached values via pub(super) fn string_values_for(&self, idx: usize) -> &[String].
  • Updates the tier dispatch loop in native.rs to call dag.string_values_for(idx) instead of re-invoking extract_string_values(&tc.input) — eliminates the redundant per-tool JSON traversal (PERF-02).

Closes #1714.

Test plan

  • All existing DAG unit tests pass (dag_* filter: 11 tests)
  • Full workspace test suite passes (5527 tests, 0 failures)
  • cargo +nightly fmt --check clean
  • cargo clippy --workspace --features full -- -D warnings clean

Add `string_values: Vec<Vec<String>>` field to `ToolCallDag` populated
during `build()`. Expose cached values via `string_values_for(idx)` and
use them in the tier dispatch loop in `native.rs` instead of calling
`extract_string_values` again per-tool — removes the redundant JSON
traversal (closes #1714).
@github-actions github-actions bot added documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate performance Performance improvements size/S Small PR (11-50 lines) labels Mar 14, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 14, 2026 17:48
@bug-ops bug-ops merged commit db19bdc into main Mar 14, 2026
15 checks passed
@bug-ops bug-ops deleted the perf-tools-cache-extracted-str branch March 14, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core zeph-core crate documentation Improvements or additions to documentation performance Performance improvements rust Rust code changes size/S Small PR (11-50 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf(tools): cache extracted string values in ToolCallDag to avoid double scan

1 participant