zero dependents optimization
zero dependents optimization

Summary:
Calculating all dependents given direct dependents currently involves a O(dependency graph) calculation: we need to reverse the dependency graph and find nodes reachable from direct dependents on it.

However, the special case of zero dependents can avoid this calculation. This diff implements the shortcut.

Reviewed By: samwgoldman

Differential Revision: D16432276

fbshipit-source-id: 3a2c1d745043a702e8a1864b7fd9596dfd4493fc

nmote/flow,nmote/flow,nmote/flow,nmote/flow,nmote/flow,nmote/flow,nmote/flow