diff --git a/proxygen/lib/http/codec/HTTP1xCodec.h b/proxygen/lib/http/codec/HTTP1xCodec.h index c3355f0ecc..466481d570 100644 --- a/proxygen/lib/http/codec/HTTP1xCodec.h +++ b/proxygen/lib/http/codec/HTTP1xCodec.h @@ -8,6 +8,7 @@ #pragma once +#include #include #include #include diff --git a/proxygen/lib/http/codec/compress/HeaderTable.cpp b/proxygen/lib/http/codec/compress/HeaderTable.cpp index 8320fc55c7..7ec65bd4aa 100644 --- a/proxygen/lib/http/codec/compress/HeaderTable.cpp +++ b/proxygen/lib/http/codec/compress/HeaderTable.cpp @@ -122,7 +122,7 @@ uint32_t HeaderTable::removeLast() { DCHECK(names_it != names_.end()); auto& ilist = names_it->second; DCHECK_EQ(ilist.front(), t); - ilist.pop_front(); + ilist.erase(ilist.begin()); // remove the name if there are no indices associated with it if (ilist.empty()) { diff --git a/proxygen/lib/http/codec/compress/HeaderTable.h b/proxygen/lib/http/codec/compress/HeaderTable.h index bbee0cc701..0eabfcc10b 100644 --- a/proxygen/lib/http/codec/compress/HeaderTable.h +++ b/proxygen/lib/http/codec/compress/HeaderTable.h @@ -8,11 +8,11 @@ #pragma once -#include #include #include #include +#include #include namespace proxygen { @@ -24,8 +24,10 @@ namespace proxygen { class HeaderTable { public: - // TODO: std::vector might be faster than std::list in the use case? - using names_map = folly::F14FastMap>; + // 7 is chosen as an empirically good value that's not too big. + // small_vector spills to the heap beyond that. + using names_map = + folly::F14ValueMap>; explicit HeaderTable(uint32_t capacityVal) { init(capacityVal); diff --git a/proxygen/lib/http/codec/compress/test/HPACKContextTests.cpp b/proxygen/lib/http/codec/compress/test/HPACKContextTests.cpp index b18549605c..5dbadf417c 100644 --- a/proxygen/lib/http/codec/compress/test/HPACKContextTests.cpp +++ b/proxygen/lib/http/codec/compress/test/HPACKContextTests.cpp @@ -83,11 +83,11 @@ TEST_F(HPACKContextTests, StaticTableHeaderNamesAreCommon) { "max-forwards", "if-range", "refresh"}; - for (std::pair> entry : table.names()) { - EXPECT_TRUE(entry.first.isCommonHeader() || - uncommonStaticEntries.find(entry.first.get()) != + for (const auto& [header, _] : table.names()) { + EXPECT_TRUE(header.isCommonHeader() || + uncommonStaticEntries.find(header.get()) != uncommonStaticEntries.end()) - << entry.first.get(); + << header.get(); } }