Profile with:
go test -c
go test -test.cpuprofile cpu.out
go tool pprof packageName.test cpu.out
in pprof:
top10, top40, etc. get most common functions
top40 -cum to sort by cumulative (+children) time
web to visualize
For tempFluc -testPlot, got:
31.7% of time spent in malloc through ZeroVector calls resulting from Vector.Add and Vector.Mul
14.3% of time spent in math.Tanh
12.9% of time spent in math.Sin
Sin calls are Sin(kx), Sin(ky); could cache these results. Vector Add/Mul allocation could be avoided by requiring result vector to already be allocated; most of the time it will be.
Profile with:
go test -c
go test -test.cpuprofile cpu.out
go tool pprof packageName.test cpu.out
in pprof:
top10, top40, etc. get most common functions
top40 -cum to sort by cumulative (+children) time
web to visualize
For tempFluc -testPlot, got:
31.7% of time spent in malloc through ZeroVector calls resulting from Vector.Add and Vector.Mul
14.3% of time spent in math.Tanh
12.9% of time spent in math.Sin
Sin calls are Sin(kx), Sin(ky); could cache these results. Vector Add/Mul allocation could be avoided by requiring result vector to already be allocated; most of the time it will be.