Skip to content

Commit 9fa21b9

Browse files
authored
add faq entry on resolver costs (#3570)
Fixes #2150
1 parent a4c7c54 commit 9fa21b9

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

docs/builder_author_faq.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,24 @@ of the code. **This is always safe**, but may place limitations on the end user.
1414
Any outputs which are used _during_ a build to produce other outputs, but don't
1515
need to be compiled or seen by the user, should also be built to `cache`.
1616

17+
## How expensive is it to get a resolved library (ex: buildStep.inputLibrary)
18+
19+
This can be a very expensive operation, depending on a number of factors.
20+
21+
The first time this is done in the build process, all transitive imports of the
22+
file have to be parsed and analyzed, and even the entire SDK may have to be
23+
analyzed.
24+
25+
We have some optimizations to make this cheaper for subsequent builders, but
26+
they can be circumvented by certain package structures. You should assume the
27+
cost will be at least on the order of the number of all transitive imports.
28+
29+
The build step will also be invalidated if any transitive import of the resolved
30+
library changes, even in the best case scenarios.
31+
32+
You should only use a resolved library if you absolutely need on. If you can
33+
use simply a parsed compilation unit instead, you should consider using that.
34+
1735
## How can I have temporary outputs only used during the Build?
1836

1937
Due to build restrictions - namely that a builder can't read the outputs

0 commit comments

Comments
 (0)