You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Surely this is a very inefficient way to determine if a string starts with another string, as potentially it will search a very large haystack to find a needle at the very end, or not at all, when all it cares about is if the needle is at the start.
And the remove_dot_segments function calls this 5 times per segment of each uri.
perhaps the following alternative would be better, as you do know the size of each prefix upfront.
I was reviewing the remove_dot_segments implementation and I noticed starts_with is implemented as:
Surely this is a very inefficient way to determine if a string starts with another string, as potentially it will search a very large haystack to find a needle at the very end, or not at all, when all it cares about is if the needle is at the start.
And the remove_dot_segments function calls this 5 times per segment of each uri.
perhaps the following alternative would be better, as you do know the size of each prefix upfront.
Of course, its better to just use a string_view, which could capture the literal string size at the callsite.
uri/src/detail/uri_resolve.cpp
Line 29 in 9f47767
The text was updated successfully, but these errors were encountered: