Closed mbrubeck closed 4 years ago
Oh sweet!
(I've filed https://github.com/hyperium/http/pull/387 for the deprecation errors.)
Note that the Link
and Links
types still store indices as usize
. Changing these to u16
would probably be beneficial for some use cases, though they are not as important as Size
and HashValue
which together make up the entire HeaderMap::indices
vector.
I didn't change Link
and Links
because it would touch a lot more code and add a lot more u16
/usize
conversions. This could be error-prone if not done carefully. However, it might be a good follow-up task.
HeaderMap currently truncates all hashes to 16 bits, and limits its capacity to 32768 elements. The comments say this is done in order to store positions and hashes as
u16
, to improve cache locality. However, they are currently stored asusize
. This branch changes the code to match the comments.This does not appear to cause any measurable improvement or regression in speed in the HeaderMap benchmarks on my workstation. However, it should at least reduce the memory footprint of every Headermap.