Per #13, I discovered that for in loops seem to allocate memory for some reason. This leads to gradually worse performance as you use for in loops over and over.
For now, we'll simply replace every instance of:
for (var key in obj) {
// ... (use obj[key])
}
With:
var keys = Object.keys(obj);
for (var i = 0; i < keys.length; i++) {
if (obj.hasOwnProperty(key)) {
// ... (use obj[keys[i]])
}
}
Per #13, I discovered that
for in
loops seem to allocate memory for some reason. This leads to gradually worse performance as you usefor in
loops over and over.For now, we'll simply replace every instance of:
With: