Skip to content

Cache optimized default searches - #68

Open
OskarEichler wants to merge 1 commit into
jmespath:mainfrom
OskarEichler:codex/default-runtime-cache
Open

Cache optimized default searches#68
OskarEichler wants to merge 1 commit into
jmespath:mainfrom
OskarEichler:codex/default-runtime-cache

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

Reuse a bounded, thread-safe default CachingRuntime for optionless JMESPath.search calls and cache optimized expression trees.

This implements the maintainer direction recorded in #25 while preserving custom runtime options and the existing Runtime/CachingParser APIs.

Reproduction

The current module-level helper constructs a new runtime/parser and re-optimizes on every call. A parser-count model proves one parse across repeated and concurrent default searches; nonempty runtime options still get isolated runtimes.

Verification

  • isolated branch: 1,790 examples, zero failures
  • 803 repeated/concurrent cache and option-isolation checks
  • cumulative candidate: 892 current compliance checks, zero failures
  • 20,000 repeated representative searches: 0.388s baseline vs 0.152s candidate (about 2.6x faster locally)
  • all runtime syntax, 33-path package build and Rails 8.1.3.1 integration pass

Compatibility

Calls with runtime options remain uncached and preserve their parser/error configuration. Cache size follows the existing 1,000-entry policy; optimized nodes are immutable during visits. Prepared with AI-assisted source review; no repository tests were changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant