Skip to content

Commit

Permalink
add faq entry on resolver costs (#3570)
Browse files Browse the repository at this point in the history
Fixes #2150
  • Loading branch information
jakemac53 authored Sep 1, 2023
1 parent a4c7c54 commit 9fa21b9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/builder_author_faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,24 @@ of the code. **This is always safe**, but may place limitations on the end user.
Any outputs which are used _during_ a build to produce other outputs, but don't
need to be compiled or seen by the user, should also be built to `cache`.

## How expensive is it to get a resolved library (ex: buildStep.inputLibrary)

This can be a very expensive operation, depending on a number of factors.

The first time this is done in the build process, all transitive imports of the
file have to be parsed and analyzed, and even the entire SDK may have to be
analyzed.

We have some optimizations to make this cheaper for subsequent builders, but
they can be circumvented by certain package structures. You should assume the
cost will be at least on the order of the number of all transitive imports.

The build step will also be invalidated if any transitive import of the resolved
library changes, even in the best case scenarios.

You should only use a resolved library if you absolutely need on. If you can
use simply a parsed compilation unit instead, you should consider using that.

## How can I have temporary outputs only used during the Build?

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

0 comments on commit 9fa21b9

Please sign in to comment.