-
-
Notifications
You must be signed in to change notification settings - Fork 117
optimize canonicalize methods for url_pattern #1033
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
Conversation
CodSpeed Performance ReportMerging #1033 will degrade performances by 99.99%Comparing Summary
Benchmarks breakdown
Footnotes
|
792e6ed to
5da3603
Compare
|
@lemire can you review? |
CarlosEduR
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, but I'd still like Daniel to take a look.
| if (!url->set_username(input)) { | ||
| return tl::unexpected(errors::type_error); | ||
| // Percent-encode the input using the userinfo percent-encode set. | ||
| size_t idx = ada::unicode::percent_encode_index( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good.
|
|
||
| if (result.ec == std::errc()) { | ||
| // Successfully parsed, return as string | ||
| return std::to_string(parsed_port); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably, this could be avoided by using the range digits_to_parse.data() to digits_to_parse.data() + digits_to_parse.size() as it should be a valid number string. Although it might be not necessary.
The whole logic here is to ensure that we have a 16-bit unsigned string. This could be better.
Still: this is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah nice touch. Agreed. Let's fix it! I'll open a PR
lemire
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This would significantly improve URLPattern performance