tonic-xds: avoid allocations when matching domains - #2858
Open
metaphorics wants to merge 4 commits into
Open
metaphorics wants to merge 4 commits into
metaphorics wants to merge 4 commits into
Conversation
Contributor
|
Thanks for the PR. The allocation optimizations lgtm, just that the |
Author
|
Surely I will clean it up. Thanks for reviewing my PR! |
Author
|
@YutaoMa Corrected the PR. |
Author
|
BTW, if you are okay. Please look at #2853 too. It's a simple & quick win for performance. Doesn't break anything. |
Initialize route_retry from its match expression. Keep route validation and retry-policy parsing in the same order. Use a checked counter in the channel example. Report counter exhaustion instead of relying on an unbounded integer range.
Compare domain strings without creating lowercase copies. Use borrowed byte slices for wildcard affixes and preserve ASCII case equivalence, match priority, and the nonempty wildcard requirement. Refs grpc#2832
metaphorics
force-pushed
the
perf/xds-domain-matching
branch
from
September 16, 2026 06:56
0c4578e to
1d01063
Compare
YutaoMa
reviewed
Sep 17, 2026
Route the wildcard affix comparisons in match_domain through starts_with_ignore_ascii_case and ends_with_ignore_ascii_case, promoting the helpers already in resource/string_matcher.rs to pub(crate) instead of adding a second copy, and add mixed-case wildcard unit tests. Refs grpc#2858
Author
|
@YutaoMa Done cleaning up and resolving your comments. Thx! |
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.
Removes the lowercase copies from
match_domain.Domains are compared with
eq_ignore_ascii_caseon the original strings, and wildcard affixes are matched through borrowed slices viachecked_sub/get. Match ordering, wildcard priority, and theNone-on-miss behavior are unchanged.Also carries two Clippy fixes in
tonic-xds(route_config.rs,examples/channel.rs).Refs #2832