Hello gn-dev@,
The Fuchsia build team has
its own fork of Ninja, and would like to implement a new feature where individual Ninja actions (build statements, or even rules) could provide an explicit "weight" value, used to optimize the scheduling of long-pole actions.
This is a slight modification of
an existing Ninja feature, where each action is assigned
a default weight of 1, which is then
propagated / added to its transitive dependents. This is used to determine a better build order, and we've seen improvements to our builds when it was merged into our tree.
The change is simply to allow a build statement to provide its own weight value > 1 for specific actions. For example something that could look like:
build some_output: some_rule some_input
weight = 100
Of course, our Ninja build plan is generated by GN, so we'd like to allow GN action() targets to specify that value (an integer) through a new argument, which would be injected into the Ninja generated build plan (and otherwise ignored by other GN writers). E.g.:
action("some_target") {
...
ninja_weight = 100
}
This feature being experimental would only be activated through a specific flag in .gn, as in:
experimental_ninja_weights = true
To ensure this doesn't modify the build plan of other projects, and would keep GN's behavior unmodified (e.g. making the "ninja_weight" assignment above an unused-variable error if the flag is not used in .gn).
We can provide CLs to implement this, but we'd appreciate your feedback on this idea.
- Digit