go/types/objectpath: reduce allocations with sync.Pool#613
go/types/objectpath: reduce allocations with sync.Pool#613ewhauser wants to merge 2 commits intogolang:masterfrom
Conversation
Use sync.Pool to reuse byte buffers and finder structs, reducing allocations by ~52% in heavy-usage scenarios. - Add pathBufPool for reusing path encoding buffers - Add smallInts lookup table for integers 0-99 - Add finderPool for reusing finder structs Benchmarking on a 9000-package monorepo with ~40 analyzers showed: - Allocations: 929MB → 445MB (52% reduction) - GC cycles: 21 → 14 (33% reduction) - GC pause time: 1.77ms → 0.81ms (54% reduction) Fixes golang/go#77059
|
This PR (HEAD: 0114d45) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/734140. Important tips:
|
|
Message from Gopher Robot: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be Please don’t reply on this GitHub thread. Visit golang.org/cl/734140. |
|
Message from Daniel Morsing: Patch Set 1: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/734140. |
|
Message from Alan Donovan: Patch Set 1: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/734140. |
|
This PR (HEAD: 343bf99) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/734140. Important tips:
|
|
Message from Alan Donovan: Patch Set 2: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/734140. |
|
Message from Alan Donovan: Patch Set 2: (3 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/734140. |
Use sync.Pool to reuse byte buffers and finder structs,
reducing allocations by ~52% in heavy-usage scenarios.
Benchmarking on a 9000-package monorepo with ~40 analyzers showed:
Fixes golang/go#77059