-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
I am using reify 0.20.12 from Meteor and am importing vec3 from gl-matrix.
My issue is that this function:
/**
* Normalize a vec3
*
* @param {vec3} out the receiving vector
* @param {ReadonlyVec3} a vector to normalize
* @returns {vec3} out
*/
export function normalize(out, a) {
let x = a[0];
let y = a[1];
let z = a[2];
let len = x * x + y * y + z * z;
if (len > 0) {
len = 1 / Math.sqrt(len);
}
out[0] = a[0] * len;
out[1] = a[1] * len;
out[2] = a[2] * len;
return out;
}
once run through reify becomes:
function normalize(out, a) {
var x = a[0];
var y = a[1];
var z = a[2];
var len = x * x + y * y + z * z;
if (len > 0) {
module.runSetters(len = 1 / Math.sqrt(len)); // <----- unexpected module.runSetters
out[0] = a[0] * len;
out[1] = a[1] * len;
out[2] = a[2] * len;
}
return out;
}
I suspect the issue triggered because another len
is later exported :
/**
* Alias for {@link vec3.length}
* @function
*/
export const len = length;
being a heavy 3D application, normalize is called 100s or 1000s of times per frame and this needless callback is really killing performance. Is this expected? Any way to avoid it?
quintstoffers, simplecommerce, sebakerckhof and Floriferous
Metadata
Metadata
Assignees
Labels
No labels