Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch task graph edges to direct dependencies #869

Merged
merged 2 commits into from
Mar 12, 2022
Merged

Conversation

gsoltis
Copy link
Contributor

@gsoltis gsoltis commented Mar 12, 2022

The main change in this PR switches the task graph construction to add edges only between direct dependencies, rather than the entire ancestor subtree.

As an example, say a depends on b, b depends on c. If b#build depends on c#some-task, and a#builddepends on^build`.

Currently, running a#build will do c#some-task, c#build, b#build, and a#build.
But, we don't need c#build. We just need c#some-task, since that's what b#build depends on, and a doesn't really know anything about c directly, just via b. So, we instead just draw an edge to direct dependencies, and then let them sort out their own dependencies.

For a large example, here are before and after graphs for running turbo run build in examples/kitchen-sink:

Before:
shallow

After:
deep

Also get rid of an unused field, taskDeps, on Scheduler.

@vercel
Copy link

vercel bot commented Mar 12, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/vercel/turbo-site/CicA14peWtnnXAMwD84KmqhpEh17
✅ Preview: https://turbo-site-git-gsoltis-directdeps.vercel.sh

@gsoltis gsoltis marked this pull request as ready for review March 12, 2022 00:53
@kodiakhq kodiakhq bot merged commit eee3387 into main Mar 12, 2022
@kodiakhq kodiakhq bot deleted the gsoltis/direct_deps branch March 12, 2022 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants