]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: speed up stack copying a little
authorJosh Bleecher Snyder <josharian@gmail.com>
Sun, 1 Oct 2017 06:06:49 +0000 (23:06 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Thu, 15 Feb 2018 15:06:34 +0000 (15:06 +0000)
Remove a branch and a stack spill.

name                old time/op  new time/op  delta
StackCopy-8         79.2ms ± 1%  79.1ms ± 2%    ~     (p=0.063 n=96+95)
StackCopyNoCache-8   121ms ± 1%   120ms ± 2%  -0.46%  (p=0.000 n=97+88)

Change-Id: Ifcbbb05d773178fad84cb11a9a6768ace69fcf24
Reviewed-on: https://go-review.googlesource.com/94029
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/runtime/symtab.go

index bdf98b9e9dc63798d41feca071490c91e4d5e45b..23d2232db56fbb954ef3e466e45a213754a1f798 100644 (file)
@@ -853,13 +853,9 @@ func step(p []byte, pc *uintptr, val *int32, first bool) (newp []byte, ok bool)
        if uvdelta&0x80 != 0 {
                n, uvdelta = readvarint(p)
        }
+       *val += int32(-(uvdelta & 1) ^ (uvdelta >> 1))
        p = p[n:]
-       if uvdelta&1 != 0 {
-               uvdelta = ^(uvdelta >> 1)
-       } else {
-               uvdelta >>= 1
-       }
-       vdelta := int32(uvdelta)
+
        pcdelta := uint32(p[0])
        n = 1
        if pcdelta&0x80 != 0 {
@@ -867,7 +863,6 @@ func step(p []byte, pc *uintptr, val *int32, first bool) (newp []byte, ok bool)
        }
        p = p[n:]
        *pc += uintptr(pcdelta * sys.PCQuantum)
-       *val += vdelta
        return p, true
 }