GlmSharp icon indicating copy to clipboard operation
GlmSharp copied to clipboard

Unnecessary Object Creation

Open Philip-Trettner opened this issue 8 years ago • 0 comments

All optimizations of the following form:

public static vec4 Sub(vec4 lhs, vec4 rhs) => new vec4(lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z, lhs.w - rhs.w);

to

public static vec4 Sub(vec4 lhs, vec4 rhs) {
    lhs.x -= rhs.x;
    lhs.y -= rhs.y;
    lhs.z -= rhs.z;
    lhs.w -= rhs.w;
    return lhs;
}

To optimize for stack usage and less object creation.

Philip-Trettner avatar Jan 18 '17 18:01 Philip-Trettner