x/net/http2: optimize typeFrameParser using an array #73613
Labels
FixPending
Issues that have a fix which has not yet been reviewed or submitted.
Implementation
Issues describing a semantics-preserving change to the Go implementation.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Go version
go version go1.24.2 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
I have been looking at gRPC overhead using the Go profiler for production services at Datadog. I noticed that http2.typeFrameParser shows up as 0.1% of total CPU for a high QPS service. I have submitted a gerrit code review to optimize this function by replacing the map lookup with an array.
Suggested micro-optimization: https://go-review.googlesource.com/c/net/+/670415
What did you see happen?
The attached screenshot shows the pprof output for a production service, focused on this function. The "0.16% of profile" suggests that this function is 0.16% of all CPU used for this service. The output shows that all the time is the map lookup since the function does not do anything else.
Suggested micro-optimization: https://go-review.googlesource.com/c/net/+/670415
What did you expect to see?
This function will use less CPU with an array lookup.
The text was updated successfully, but these errors were encountered: