x/net/http2: generate static table in hpack module before runtime #55881
Labels
FrozenDueToAge
NeedsFix
The path to resolution is known, but the work has not been done.
Performance
Milestone
As the static version of headerFieldTable in hpack module is generated in runtime, we may use the go:generate to prepare the struct before the initialization phase.
This is supposed to save init time and allocations for many binaries, as net/http imports hpack.
Before:
init golang.org/x/net/http2/hpack @1.1 ms, 0.097 ms clock, 21240 bytes, 29 allocs
After:
init golang.org/x/net/http2/hpack @0.67 ms, 0.015 ms clock, 8120 bytes, 9 allocs
We also could add isStatic field, so we will be able to remove less readable pointer comparison in the
idToIndex
method and again reduce allocations. BenchmarkEncoderSearchTable is okay with this:EncoderSearchTable-8 6.75µs ± 7% 6.57µs ± 6% ~ (p=0.099 n=10+10)
The text was updated successfully, but these errors were encountered: