Optimize is_awaiting_external_dependency by checking dep set first