Avoid forking hydra-build from hydra-queue-runner, reducing RAM use.
Use faster queryReferences instead of computeFSClosure, cache results.

With the original code and a long queue, hydra-queue-runner spends 99% of time
in findBuildDependencyInQueue (loading data from the store).