Closed jessegreenberg closed 6 years ago
Also, curvatureTemp looks like:
curvatureTemp: { r: 1, x: 0, y: 0 },
Are the initial values important?
curvatureTemp and curvatureTemp2 are not instance variables and should not be moved to the constructor--it seems they should be moved closer to this line:
// Reuse empty object for creating SkaterStates to avoid allocations
var EMPTY_OBJECT = {};
Since they have similar intent. The initial values are not important--these curvatureTemp
objects were introduced to prevent memory allocations to get acceptable performance on iPad.
Thanks, I understand now. Sounds good.
This was done in ESP, closing this issue.
From #398 - I noticed that the curvatureTemp2 and cuvatureTemp are used to track cuvature of the track at the skater's location. They are added to the prototype in the inherit call of EnergySkateParkBasicsModel.js. I haven't seen variables declared here before. @samreid is there an allocation benefit of defining these variables here? Could they be moved to the constructor?