mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: measure stack usage; start stacks larger if needed
Measure the average stack size used by goroutines at every GC. When starting a new goroutine, allocate an initial goroutine stack of that average size. Intuition is that we'll waste at most 2x in stack space because only half the goroutines can be below average. In turn, we avoid some of the early stack growth / copying needed in the average case. More details in the design doc at: https://docs.google.com/document/d/1YDlGIdVTPnmUiTAavlZxBI1d9pwGQgZT7IKFKlIXohQ/edit?usp=sharing name old time/op new time/op delta Issue18138 95.3µs ± 0% 67.3µs ±13% -29.35% (p=0.000 n=9+10) Fixes #18138 Change-Id: Iba34d22ed04279da7e718bbd569bbf2734922eaa Reviewed-on: https://go-review.googlesource.com/c/go/+/345889 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com>
This commit is contained in:
parent
da0a6f4b57
commit
016d755213
12 changed files with 168 additions and 42 deletions
|
|
@ -140,6 +140,12 @@ var allDesc = []Description{
|
|||
Kind: KindFloat64Histogram,
|
||||
Cumulative: true,
|
||||
},
|
||||
{
|
||||
Name: "/gc/stack/starting-size:bytes",
|
||||
Description: "The stack size of new goroutines.",
|
||||
Kind: KindUint64,
|
||||
Cumulative: false,
|
||||
},
|
||||
{
|
||||
Name: "/memory/classes/heap/free:bytes",
|
||||
Description: "Memory that is completely free and eligible to be returned to the underlying system, " +
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue