Skip to content

Instantly share code, notes, and snippets.

@panmari
Created January 8, 2015 16:58
Show Gist options
  • Save panmari/a2ea60894c820f83128c to your computer and use it in GitHub Desktop.
Save panmari/a2ea60894c820f83128c to your computer and use it in GitHub Desktop.
func BenchmarkMulVec4(b *testing.B) {
m1 := &T{vec4.T{0.38016528, -0.0661157, -0.008264462, -0}, vec4.T{-0.19834709, 0.33884296, -0.08264463, 0}, vec4.T{0.11570247, -0.28099173, 0.21487603, -0}, vec4.T{18.958677, -33.471073, 8.066115, 0.99999994}}
b.ResetTimer()
for i := 0; i < b.N; i++ {
v := vec4.T{1, 1.5, 2, 2.5}
v_1 := m1.MulVec4(&v)
m1.MulVec4(&v_1)
}
}
func BenchmarkTransformVec4(b *testing.B) {
m1 := &T{vec4.T{0.38016528, -0.0661157, -0.008264462, -0}, vec4.T{-0.19834709, 0.33884296, -0.08264463, 0}, vec4.T{0.11570247, -0.28099173, 0.21487603, -0}, vec4.T{18.958677, -33.471073, 8.066115, 0.99999994}}
b.ResetTimer()
for i := 0; i < b.N; i++ {
v := vec4.T{1, 1.5, 2, 2.5}
m1.TransformVec4(&v)
m1.TransformVec4(&v)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment