Perf: TokenJuice regex_match/regex_replace recompile on every call
Summary
src/openhuman/tokenjuice/reduce.rs — regex_match(), regex_replace(), and regex_captures() compile a new Regex via Regex::new(pattern) on every invocation. These are called in loops for every line of tool output. For large outputs (hundreds of lines × multiple patterns), this causes significant unnecessary overhead.
Impact
Medium — Measurable latency on large tool outputs. Regex compilation is O(pattern_length) and dominates per-line processing.
Fix Available
PR #1918 replaces these with a thread-local regex cache. All 74 existing tests pass unchanged.
Status check against current origin/main: this appears resolved by #1918.
Evidence:
- #1918 is merged: https://github.com/tinyhumansai/openhuman/pull/1918
- Current
src/openhuman/tokenjuice/reduce.rshas athread_local!regex cache around the helper functions instead of compiling every call. - The call sites still go through
regex_match,regex_replace, andregex_captures, but those helpers now reuse cachedRegexinstances.
I think this issue can be closed as fixed unless there is a separate remaining perf concern beyond the per-pattern compilation cache.
Confirmed resolved by #1918 (merged). The regex cache is now in place. Closing.