Skip to content

perf: Get context values by name without running JSONPath queries - #358

Draft
khvn26 wants to merge 1 commit into
perf/04-string-coercionfrom
perf/05-jsonpath-names
Draft

khvn26 wants to merge 1 commit into
perf/04-string-coercionfrom
perf/05-jsonpath-names

Conversation

@khvn26

@khvn26 khvn26 commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Most context value properties select names one after the other, such as $.identity.identifier, $.environment.name or $.flags.<name>.enabled. Each lookup ran the compiled JSONPath query.

Such properties are now detected once per property (the getter is already cached) and looked up by walking the context by those names. This mirrors how jsonpath_rfc9535 selects names: from dicts only, swallowing a KeyError, including one raised while resolving $.flags. Any other query (indices, wildcards, filters, descendants, multiple selectors) still runs as before. A test checks results against the query for both kinds of property.

Effect: ~2.9 → ~0.6 µs per lookup. Identity evaluation with released SDKs, which keep one $.identity.identifier segment per set of identity overrides, is about 2× faster with 1,000 of them (5.0 → 2.4 ms).

Part of a stack of local evaluation performance PRs; see #353 for the stack and combined results. perf/all holds the whole stack for benchmarking.

Most context value properties select names one after the other, such as
`$.identity.identifier`, `$.environment.name` or `$.flags.<name>.enabled`.
Each was looked up by running the compiled JSONPath query.

Such properties are now looked up by walking the context by those names,
as `jsonpath_rfc9535` selects names: from dicts only, swallowing a
`KeyError`. Other queries still run. About 5x faster per lookup.
@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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