Improve performance of refs.ReachableFrom()