Skip to content

Commit

Permalink
Dagger performance improvements.
Browse files Browse the repository at this point in the history
Memoization speeds up Dagger processing by 14% and speeds up overall build time by 5%.

RELNOTES=Minor improvements to Dagger build performance.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=267430637
  • Loading branch information
bcorso authored and kluever committed Sep 6, 2019
1 parent 646e033 commit e92edf6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions java/dagger/internal/codegen/binding/BindingGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,17 @@ public ImmutableSet<ComponentRequirement> componentRequirements() {

private ImmutableSet<TypeElement> requiredModuleElements() {
return stream(SUBGRAPH_TRAVERSER.depthFirstPostOrder(this))
.flatMap(graph -> graph.contributionBindings().values().stream())
.flatMap(graph -> graph.bindingModules().stream())
.filter(ownedModuleTypes()::contains)
.collect(toImmutableSet());
}

@Memoized
protected ImmutableSet<TypeElement> bindingModules() {
return contributionBindings().values().stream()
.flatMap(bindings -> bindings.contributionBindings().stream())
.map(ContributionBinding::contributingModule)
.distinct()
.flatMap(presentValues())
.filter(ownedModuleTypes()::contains)
.collect(toImmutableSet());
}

Expand Down

0 comments on commit e92edf6

Please sign in to comment.