You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2023/01/20 00:06:48 UTC

[GitHub] [trafficserver] bneradt commented on a diff in pull request #9298: Limit the serching range of static table by the first letter of header name

bneradt commented on code in PR #9298:
URL: https://github.com/apache/trafficserver/pull/9298#discussion_r1081989070


##########
proxy/http2/HPACK.cc:
##########
@@ -227,7 +256,20 @@ namespace HpackStaticTable
   {
     HpackLookupResult result;
 
-    for (unsigned int index = 1; index < TS_HPACK_STATIC_TABLE_ENTRY_NUM; ++index) {
+    // Limit the search range of static table
+    unsigned int start = 1;

Review Comment:
   Maybe comment that the first real header value in TS_HPACK_STATIC_TABLE_ENTRY starts at 1? Without that context, initializing at 1 instead of 0 was surprising to me.



##########
proxy/http2/HPACK.cc:
##########
@@ -227,7 +256,20 @@ namespace HpackStaticTable
   {
     HpackLookupResult result;
 
-    for (unsigned int index = 1; index < TS_HPACK_STATIC_TABLE_ENTRY_NUM; ++index) {
+    // Limit the search range of static table
+    unsigned int start = 1;
+    unsigned int end   = TS_HPACK_STATIC_TABLE_ENTRY_NUM;
+    if ('a' <= header.name[0] && header.name[0] <= 'z') {

Review Comment:
   Since we're optimizing, does it help to grab the first character once and use that?
   
   ```
   char const first_char = header.name[0];
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org