-
Notifications
You must be signed in to change notification settings - Fork 64
Closed
Description
I got an email recently with some bechmarks. The long and short is: once you get to Mat4 size, it is a significant speed improvement (about 13 ns/op for multiplcation) to use a pointer for Mat4. This is a significant API change and would break a lot of existing code. Doing
m := mgl32.Ident4()
m[0] = 5
Would break. Any code that currently uses any of: At and Set for matrices or X, Y, Z, or W for vectors is safe (SetX and the like would likely needed to be added for Vectors).
The way I see it, there are two potential solutions here:
- Redo everything to use pointers. This, as mentioned, breaks existing code.
- Add functions like
func (m *Mat4) MulTo(dst *Mat4, m2 *Mat4)which would have similar semantics to*MatMN.MulMN(dst, m2).
I like option 2, since there's no compatability breakage, but it does clutter the API and people may mistakenly use the slower code without realizing it.
Thoughts?
Metadata
Metadata
Assignees
Labels
No labels