[feature-request] Replace std::unordered_map
with flat map for http headers
#142
Labels
std::unordered_map
with flat map for http headers
#142
Looking at flamegraphs from #141 (comment) one can see that
unordered_map
takes ~10-11% off total time, with most of it coming from http internals (and some fromTimeStorage
).There is an idea that it could very well be replaced with flat map, that would fall back to unordered_map after some threshold, and chances are it would perform better - not only std::unordered_map is pretty slow and linear search might perform better for small number of keys, but there also is that HashDOS-preventing hash, which ain't the fastest. Also my experience tells me that it's not that common to have, say, 50+ headers in http.
What is also promising is that this abstract
HttpHeadersMap
could be implemented via on stack buffer containing data in http-format right away! - just add some array of string_views which indexes into that buffer. Not sure whether that would work for requests, but should be possible for responses, and for responses we could just pass it's content inSocket::SendAll
as isThe text was updated successfully, but these errors were encountered: