Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Benchmark on Go1.10:
Benchmark on Go1.11:
We can see that
BenchmarkMoreStack
has improved dramatically, it's even faster than a pooled version.So it's time to remove the goroutine pool.
What is changed and how it works?
goroutine pool was introduced to handle stack copy cost #3752 #3753
Go1.11 has many optimizations for stack copy:
https://go-review.googlesource.com/c/go/+/94029 runtime: speed up stack copying a little
https://go-review.googlesource.com/c/go/+/104737 runtime: avoid calling adjustpointers unnecessarily
https://go-review.googlesource.com/c/go/+/108945 runtime: add fast version of getArgInfo
https://go-review.googlesource.com/c/go/+/109716 runtime: iterate over set bits in adjustpointers
https://go-review.googlesource.com/c/go/+/109001 runtime: allow inlining of stackmapdata
https://go-review.googlesource.com/c/go/+/104175 cmd/compile: shrink liveness maps
These optimizations collectively improve stack copy performance by ~2X
After upgrading to Go1.1, goroutine pool is not necessary any more.
Check List
Tests
Code changes
remove
goroutine_pool
package and update the code