]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: switch default stack size back to 8kB
authorRuss Cox <rsc@golang.org>
Tue, 20 May 2014 04:30:46 +0000 (00:30 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 20 May 2014 04:30:46 +0000 (00:30 -0400)
The move from 4kB to 8kB in Go 1.2 was to eliminate many stack split hot spots.

The move back to 4kB was predicated on copying stacks eliminating
the potential for hot spots.

Unfortunately, the fact that stacks do not copy 100% of the time means
that hot spots can still happen under the right conditions, and the slowdown
is worse now than it was in Go 1.2. There is a real program in issue 8030 that
sees about a 30x slowdown: it has a reflect call near the top of the stack
which inhibits any stack copying on that segment.

Go back to 8kB until stack copying can be used 100% of the time.

Fixes #8030.

LGTM=khr, dave, iant
R=iant, khr, r, bradfitz, dave
CC=golang-codereviews
https://golang.org/cl/92540043

doc/go1.3.html
src/pkg/runtime/stack.h

index fa9e3f7784f2396dffee31a6865f1a6b2255c073..5404f4ec66a0db8a4f2321888bdcaee1bf8f5cdf 100644 (file)
@@ -118,13 +118,6 @@ Details including performance numbers are in this
 <a href="http://golang.org/s/contigstacks">design document</a>.
 </p>
 
-<h3 id="stack_size">Stack size</h3>
-
-<p>
-Go 1.2 increased the minimum stack size to 8 kilobytes; with the new stack model, it has been
-put back to 4 kilobytes.
-</p>
-
 <h3 id="garbage_collector">Changes to the garbage collector</h3>
 
 <p>
index a3a5d83a64f879f86303f205e660fda94fb04bba..18ab30b69b131e3e62644cc40006a74617d801a2 100644 (file)
@@ -76,7 +76,7 @@ enum {
        // The minimum stack segment size to allocate.
        // If the amount needed for the splitting frame + StackExtra
        // is less than this number, the stack will have this size instead.
-       StackMin = 4096,
+       StackMin = 8192,
        StackSystemRounded = StackSystem + (-StackSystem & (StackMin-1)),
        FixedStack = StackMin + StackSystemRounded,