Open
Description
Currently, the updateProperties
function works like this:
updateProperties (properties) {
let dirty = false;
if ('position' in properties && (...)) { ... }
if ('direction' in properties && (...)) { ... }
if ('scale' in properties && (...)) { ... }
if ('visible' in properties) { ... }
There's also an if (effectName in properties)
check for each effect.
Since updateProperties
is called so frequently, it's possible that doing so many in
checks is unnecessarily expensive. We could instead iterate the properties of properties
(heh) and act on what we find, for example.
It's hard to say for sure whether this would improve performance without benchmarking, though: the properties
object tends to not have very many entries per call, but does that mean that the in
checks are cheap or does it mean that iterating is an even better idea? Is the time spent handling the in
checks even significant to begin with?