-
Notifications
You must be signed in to change notification settings - Fork 4
/
asm_test.go
51 lines (40 loc) · 914 Bytes
/
asm_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
import (
"testing"
)
var (
benchResultVec4 []Vec4
)
func BenchmarkMatrixMultiplyVec4Batch_Large(b *testing.B) {
m := NewIdentityMatrix()
m = NewRotationMatrix(0.1, 0.2, 0.3).Multiply(m)
m = NewTranslationMatrix(1, 2, 3).Multiply(m)
vecs := make([]Vec4, 1000)
for i := range vecs {
vecs[i] = Vec4{
float32(i),
float32(i),
float32(i),
float32(i),
}
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
matrixMultiplyVec4Batch(&m, vecs)
}
benchResultVec4 = vecs
}
func BenchmarkMatrixMultiplyVec4Batch_Small(b *testing.B) {
m := NewIdentityMatrix()
m = NewRotationMatrix(0.1, 0.2, 0.3).Multiply(m)
m = NewTranslationMatrix(1, 2, 3).Multiply(m)
vecs := make([]Vec4, 3)
for i := range vecs {
vecs[i] = Vec4{float32(i), float32(i), float32(i), float32(i)}
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
matrixMultiplyVec4Batch(&m, vecs)
}
benchResultVec4 = vecs
}