Try not to use memcmp(sv, sv) and strncasecmp(sv, sv) because we don't care which value comes first on a dictionary. Return immediately if the lengths of given strings don't match. Also, we noticed with profiling that taking char* and int was more performant than taking std::string_view.
| 212 | // Return immediately if the lengths of given strings don't match. |
| 213 | // Also, we noticed with profiling that taking char* and int was more performant than taking std::string_view. |
| 214 | inline bool |
| 215 | match(const char *s1, int s1_len, const char *s2, int s2_len) |
| 216 | { |
| 217 | if (s1_len != s2_len) { |
| 218 | return false; |
| 219 | } |
| 220 | |
| 221 | if (s1 == s2) { |
| 222 | return true; |
| 223 | } |
| 224 | |
| 225 | if (memcmp(s1, s2, s1_len) != 0) { |
| 226 | return false; |
| 227 | } |
| 228 | |
| 229 | return true; |
| 230 | } |
| 231 | |
| 232 | // |
| 233 | // The first byte of an HPACK field unambiguously tells us what |
no test coverage detected