250ms represents 96.15% of the total runtime. This is too short to meaningfully profile, the amount of time needs to be in seconds at least.
I strongly recommend you write your function as a testing.Benchmark the you get profiling for free and can adjust the amount of time each benchmark runs for.
I started to write this but you haven’t provided a runnable sample so I couldn’t finish it. This should be pretty close
package vectors
import (
"math/rand"
"testing"
"github.com/deathly809/gomath"
)
func genFloat32Array(n int, min, max float32) []float32 {
A := make([]float32, n)
for i := 0; i < n; i++ {
A[i] = gomath.ScaleFloat32(min, max, 0, 1.0, rand.Float32())
}
return A
}
/* stuff */
const (
N = 100000000
)
/* stuff */
var (
A = genFloat32Array(N, 0.0, 1.0)
B = genFloat32Array(N, 0.0, 1.0)
)
var result []float32
func BenchmarkDotFloat32(b *testing.B) {
var r []float32
for i := 0; i < b.N; i++ {
r = DotFloat32(A, B)
}
result = r
}
I already have some benchmarking code written, but I am not sure how I would profile it since the profiling tool requires an executable to run. Maybe the answer is in one of the links so I will check those out.
I think I figured out what is going on. The function that it shows does not call anymore functions. It was showing all the functions but I was just too confused to realize it.