Restore a shortcut in hot loop in _mime_hdr_field_list_search_by_string#13119
Restore a shortcut in hot loop in _mime_hdr_field_list_search_by_string#13119masaori335 wants to merge 3 commits intoapache:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR restores a fast-path check in the MIME header field linear search hot loop to reduce unnecessary case-insensitive string comparisons and recover throughput regression seen on the 10.2.x branch.
Changes:
- Add a name-length equality check before calling
strcasecmp()in_mime_hdr_field_list_search_by_string().
|
What strcasecmp() is it calling and look at inlining the function? |
|
This The problem is that this trafficserver/lib/swoc/src/string_view_util.cc Lines 29 to 47 in a26a2d8 |
|
I introduced a new helper function, I found 3b0f0b7 did the same change in three places, so this PR restores the length check with There're so many other libswoc |
| For case-sensitive comparison, use @c std::string_view::operator==. | ||
| */ | ||
| inline bool | ||
| iequals(std::string_view lhs, std::string_view rhs) noexcept |
There was a problem hiding this comment.
Standard library doesn't have this, but boost has one. I followed the naming.
https://www.boost.org/doc/libs/latest/libs/beast/doc/html/beast/ref/boost__beast__iequals.html
@c-taylor noticed the 10.2.x branch has regression of throughput performance. It looks like several changes made it but the first big drop is introduced by
3b0f0b760387af0c4f6fdd40c4bc98f14dbf0c4d. The shortcut in the hot loop seems important.Below is comparison of 1 URL against 1 ET_NET thread performance.