Merged
Conversation
lemire
reviewed
Jan 6, 2023
| // TODO: Refactor this to not use `std::vector` but use pointer arithmetic for performance. | ||
| bool ends_in_a_number(const std::string_view input) noexcept { | ||
| // Let parts be the result of strictly splitting input on U+002E (.). | ||
| std::vector<std::string> parts = ada::helpers::split_string_view(input, '.', false); |
Member
There was a problem hiding this comment.
Getting rid of std::vector in this code is assuredly a good step forward. Please merge.
std::vector will tend to allocate on the heap. You want to avoid that as much as possible. It is expensive in our context.
lemire
approved these changes
Jan 6, 2023
anonrig
commented
Jan 6, 2023
|
|
||
| // If parsing last as an IPv4 number does not return failure, then return true. | ||
| return ada::parser::parse_ipv4_number(last).has_value(); | ||
| return is_ipv4_number_valid(std::string(pointer_start, pointer_end)); |
Member
Author
There was a problem hiding this comment.
Next step will be to remove this. I'm working on it.
miguelteixeiraa
added a commit
to miguelteixeiraa/node
that referenced
this pull request
Jan 16, 2023
Removes the use of vector in EndsInANumber and uses IsIPv4NumberValid instead of parsing the number to check if it is valid. Fixes: nodejs/performance#36 Refs: ada-url/ada#36
nodejs-github-bot
pushed a commit
to nodejs/node
that referenced
this pull request
Jan 23, 2023
Removes the use of vector in EndsInANumber and uses IsIPv4NumberValid instead of parsing the number to check if it is valid. Fixes: nodejs/performance#36 Refs: ada-url/ada#36 PR-URL: #46227 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
ruyadorno
pushed a commit
to nodejs/node
that referenced
this pull request
Feb 1, 2023
Removes the use of vector in EndsInANumber and uses IsIPv4NumberValid instead of parsing the number to check if it is valid. Fixes: nodejs/performance#36 Refs: ada-url/ada#36 PR-URL: #46227 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
juanarbol
pushed a commit
to nodejs/node
that referenced
this pull request
Mar 3, 2023
Removes the use of vector in EndsInANumber and uses IsIPv4NumberValid instead of parsing the number to check if it is valid. Fixes: nodejs/performance#36 Refs: ada-url/ada#36 PR-URL: #46227 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
juanarbol
pushed a commit
to nodejs/node
that referenced
this pull request
Mar 5, 2023
Removes the use of vector in EndsInANumber and uses IsIPv4NumberValid instead of parsing the number to check if it is valid. Fixes: nodejs/performance#36 Refs: ada-url/ada#36 PR-URL: #46227 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
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.
Before
After