Reduce resource-selector benchmark regressions via selector parse caching and canonical fast-path#1884
Draft
Reduce resource-selector benchmark regressions via selector parse caching and canonical fast-path#1884
Conversation
|
|
…work Agent-Logs-Url: https://github.com/flanksource/duty/sessions/0e75e66d-86e1-4003-9fdf-356336804af3 Co-authored-by: moshloop <1489660+moshloop@users.noreply.github.com>
Agent-Logs-Url: https://github.com/flanksource/duty/sessions/0e75e66d-86e1-4003-9fdf-356336804af3 Co-authored-by: moshloop <1489660+moshloop@users.noreply.github.com>
Agent-Logs-Url: https://github.com/flanksource/duty/sessions/0e75e66d-86e1-4003-9fdf-356336804af3 Co-authored-by: moshloop <1489660+moshloop@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix benchmark regressions in resource selector configurations
Reduce resource-selector benchmark regressions via selector parse caching and canonical fast-path
Apr 14, 2026
Benchstat (Other)Base: ✅ 5 improvement(s)
Full benchstat output |
Benchstat (RLS)Base: 📊 1 minor regression(s) (all within 5% threshold)
✅ 4 improvement(s)
Full benchstat output |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses the benchmark regressions introduced around resource selector query construction and config lookup paths (
ResourceSelectorConfigs/*,ResourceSelectorQueryBuild/tags) and trims repeated selector-processing overhead in hot loops.Resource selector clause hot-path optimization
SetResourceSelectorClauseto avoid repeatedly parsing identical selector PEG strings.agent_id/deleted_atdetection.Selector requirements parse deduplication
labels.Parse(...).Requirements()for the same selector strings.TagSelector,LabelSelector, andFieldSelectorhandling inSetResourceSelectorClause.Canonicalization fast-path
ResourceSelector.Canonical()when no wildcard is present, skipping normalization work on common non-wildcard selectors.Safety hardening for cached values