Repository navigation
perf(jq): reuse compiled filters within an execution - #2966
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | d16a5cd | Commit Preview URL Branch Preview URL |
Nov 22 2026, 02:01 AM |
Review verdict: approve-worthy, no findingsThis is a clean, well-scoped perf change. Correctness of the cache key (verified): compilation depends only on the expanded source ( Concurrency and bounds (verified): the mutex covers only lookup/replacement; compilation happens outside the lock, and concurrent duplicate misses collapse to a single slot via the dedupe in What I read beyond the diff: No inline findings; no review submitted per workflow. I could not build or run tests here (no cargo in this shell), so this is reasoning-from-code only. |
What changed
Bashkit reuses up to four compiled inline
jqfilters within a single execution. The least recently used filter is evicted when the cache fills. The cache key includes the source and ordered binding names. Each invocation evaluates with its own input, bindings, environment, and limits. Bashkit also parses the fixed jaq and compatibility definitions once per process.Why
The original fan-out profile attributed about half of sampled CPU time to
jqfilter parsing and compilation. The repeated and interleaved workloads capture reuse, and the distinct-filter workload measures compilation on cache misses.Before / After
The fan-out runs verified exact output, stderr, and exit status. Both isolated reruns of the 4,096-row aggregate favored the pre-parsed build after an initial slowdown.
Risk
Checklist
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.