mirror of
https://github.com/golang/go
synced 2024-11-24 12:00:14 -07:00
reflect: adjust MapRange allocation test for noopt builder, take 2
Change-Id: If2887f84b3d14fac3c059fc5bad4186ec9d69d0f Reviewed-on: https://go-review.googlesource.com/c/go/+/401077 Reviewed-by: Joseph Tsai <joetsai@digital-static.net> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Keith Randall <khr@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
689dc17793
commit
aa8262d800
@ -364,6 +364,10 @@ func TestMapIterSet(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if strings.HasSuffix(testenv.Builder(), "-noopt") {
|
||||||
|
return // no inlining with the noopt builder
|
||||||
|
}
|
||||||
|
|
||||||
got := int(testing.AllocsPerRun(10, func() {
|
got := int(testing.AllocsPerRun(10, func() {
|
||||||
iter := v.MapRange()
|
iter := v.MapRange()
|
||||||
for iter.Next() {
|
for iter.Next() {
|
||||||
@ -375,9 +379,6 @@ func TestMapIterSet(t *testing.T) {
|
|||||||
// The function is inlineable, so if the local usage does not escape
|
// The function is inlineable, so if the local usage does not escape
|
||||||
// the *MapIter, it can remain stack allocated.
|
// the *MapIter, it can remain stack allocated.
|
||||||
want := 0
|
want := 0
|
||||||
if strings.HasSuffix(testenv.Builder(), "-noopt") {
|
|
||||||
want = 1 // no inlining with the noopt builder
|
|
||||||
}
|
|
||||||
if got != want {
|
if got != want {
|
||||||
t.Errorf("wanted %d alloc, got %d", want, got)
|
t.Errorf("wanted %d alloc, got %d", want, got)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user