build icon indicating copy to clipboard operation
build copied to clipboard

Optimization question: does `_assetGraph.computeOutputs()` need to be fully computed?

Open gmpassos opened this issue 2 months ago • 1 comments

I'm looking at _assetGraph.computeOutputs, and I see it's only used in this line:

https://github.com/dart-lang/build/blob/3b47ff216e06d5a4844365ba4d7fe30fdc41a571/build_runner/lib/src/io/build_output_reader.dart#L203

Does computeOutputs() need to be run for all nodes?

Do you think populating only the accessed nodes would be faster?

Best regards.

gmpassos avatar Oct 24 '25 20:10 gmpassos

It's reversing the outputs graph, so I think you have to process the whole thing in one go, then the result is cached for later lookups.

It's used if serving the results or if copying to a merged output folder ... I'm not sure if there is a use case where the performance matters too much, but I haven't actually tried to measure.

davidmorgan avatar Oct 27 '25 08:10 davidmorgan