style: Don't loop over all the set of dependencies always. …
The dependency count is not at all minor, and this way we avoid looping through all of them in the common cases, mainly either changing state, or attributes.