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

Prioritize most affected outputs #153

Merged
merged 1 commit into from
Mar 23, 2025

Conversation

elliotgoodrich
Copy link
Owner

If a build is going to fail, we want it to fail as fast as possible. This will give quicker feedback to the developer and reduce build resources.

To facilitate this, we want to prioritize build edges that depend on changed files over other build edges that are at the same dependency level. e.g. for C++ projects we want to start compiling modified source files before other sources files that belong to the same library/executable. In this case we shouldn't increase (on average) the total build time on a successful fun, but an unsuccessful build would fail much faster.

In ninja 1.12.0 a critical path schedule was added ninja-build/ninja#2177, which prioritizes build commands based on their distance from the build target. If two or more build commands have the same distance, it looks like the one that appears first in the build file is built first.

Before ninja 1.12.0, the one that appears first in the build file is prioritized.

This commit floats all affected commands to the top of the ninja build file (as far as it is possible at least) so that older ninja versions will work, and it helps ninja 1.12.0 in the case of ties.

A future change will need to be made to artificially lengthen the critical path for affected files so that ninja 1.12.0+ will be fully supported.

If a build is going to fail, we want it to fail as fast as possible.
This will give quicker feedback to the developer and reduce build
resources.

To facilitate this, we want to prioritize build edges that depend on
changed files over other build edges that are at the same dependency
level. e.g. for C++ projects we want to start compiling modified
source files before other sources files that belong to the same
library/executable.  In this case we shouldn't increase (on average) the
total build time on a successful fun, but an unsuccessful build would
fail much faster.

In ninja 1.12.0 a critical path schedule was added
ninja-build/ninja#2177, which prioritizes build
commands based on their distance from the build target.  If two or more
build commands have the same distance, it looks like the one that
appears first in the build file is built first.

Before ninja 1.12.0, the one that appears first in the build file is
prioritized.

This commit floats all affected commands to the top of the ninja build
file (as far as it is possible at least) so that older ninja versions
will work, and it helps ninja 1.12.0 in the case of ties.

A future change will need to be made to artificially lengthen the
critical path for affected files so that ninja 1.12.0+ will be fully
supported.
@elliotgoodrich elliotgoodrich force-pushed the prioritize-most-affected-outputs branch from 04c72a8 to c7256eb Compare March 23, 2025 07:49
@elliotgoodrich elliotgoodrich merged commit fc0c905 into main Mar 23, 2025
10 checks passed
@elliotgoodrich elliotgoodrich deleted the prioritize-most-affected-outputs branch March 23, 2025 08:10
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.

1 participant