Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor opt: minor optimization to the orca parser #36492

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

wbpcode
Copy link
Member

@wbpcode wbpcode commented Oct 8, 2024

Commit Message: minor opt: minor optimization to the orca parser
Additional Description:

By this way, the parser needn't to scan the whole header value if the header value has invalid format. And the we needn't create a copy of the header value for json format now.

Risk Level: low.
Testing: n/a.
Docs Changes: n/a.
Release Notes: n/a.
Platform Specific Features: n/a.

@alyssawilk
Copy link
Contributor

/wait-any on CI

Copy link
Contributor

@adisuissa adisuissa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
Overall LGTM, modulo minor comment.
Assigning Blake as the original contributor of this code.
/assign @blake-snyder

#else
IS_ENVOY_BUG("JSON formatted ORCA header support not implemented for this build");
#endif // !ENVOY_ENABLE_FULL_PROTOS || !ENVOY_ENABLE_YAML
} else {
return absl::InvalidArgumentError(
fmt::format("unsupported ORCA header format: {}", split_header.first));
return absl::InvalidArgumentError(fmt::format("unsupported ORCA header format"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd consider keeping some string as part of the error.
I think it makes sense to keep the minimum between the first 5 characters, and the prefix up to the first occurrence of a " " (the delimiter).
It makes it easier to debug if/when things go wrong with an external upstream server.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM.

@adisuissa
Copy link
Contributor

/wait-any on CI

@alyssawilk
Copy link
Contributor

(yeah I just invited blake to the org but I think it hasn't gone through yet =P)

Signed-off-by: wangbaiping <[email protected]>
Signed-off-by: wangbaiping <[email protected]>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to split changes to the utility files/methods out into another PR as their impact isn't limited to ORCA code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OKay to me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to split changes to the utility files/methods out into another PR as their impact isn't limited to ORCA code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #36525

@wbpcode
Copy link
Member Author

wbpcode commented Oct 10, 2024

block by #36525

Signed-off-by: wangbaiping <[email protected]>
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.

4 participants