Sorry for the poor title -- I haven't done enough digging to know how to be more specific about the problem.
I'm comparing the following go versions:
go version go1.8 linux/amd64
go version go1.9beta1 linux/amd64
The following benchmark exhibits a significant slowdown:
package main
import (
"testing"
)
type MPG []P
type P struct {
p uint16
idx uint32
}
type Dim interface {
g(mpg MPG, scale uint32)
}
type dim struct {
cells []uint32
}
func (d *dim) g(mpg MPG, scale uint32) {
for i, p := range mpg {
mpg[i].idx += scale * uint32(d.cells[int(p.p)])
}
}
func BenchmarkGM(b *testing.B) {
const numRows = 50000
cells := make([]uint32, numRows)
var dim Dim = &dim{cells: cells}
for i := range cells {
cells[i] = uint32(i % 2)
}
mpg := make(MPG, numRows)
for i := range mpg {
mpg[i].p = uint16(i)
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
dim.g(mpg, 5)
}
}
name old time/op new time/op delta
GM-4 59.6µs ± 0% 71.4µs ± 1% +19.80% (p=0.008 n=5+5)
This is extracted from a big suite of dozens of similar benchmarks in an internal codebase. Most of these benchmarks stayed the same or got faster in Go 1.9beta1, but a few got slower. I know that low-level codegen optimizations often make many benchmarks speed up while causing a few to slow down, but I thought it would be good to bring an example slowdown here in case it's not one of those. (Overall we're very happy with performance changes in 1.8->1.9beta1.)
Sorry for the poor title -- I haven't done enough digging to know how to be more specific about the problem.
I'm comparing the following go versions:
go version go1.8 linux/amd64
go version go1.9beta1 linux/amd64
The following benchmark exhibits a significant slowdown:
This is extracted from a big suite of dozens of similar benchmarks in an internal codebase. Most of these benchmarks stayed the same or got faster in Go 1.9beta1, but a few got slower. I know that low-level codegen optimizations often make many benchmarks speed up while causing a few to slow down, but I thought it would be good to bring an example slowdown here in case it's not one of those. (Overall we're very happy with performance changes in 1.8->1.9beta1.)