Skip to content

Commit

Permalink
Replace stream usage to reduce garbage creation on hot codepaths.
Browse files Browse the repository at this point in the history
    RELNOTES: None.
    PiperOrigin-RevId: 240765715
  • Loading branch information
Luca Di Grazia committed Sep 4, 2022
1 parent 290069f commit 9b12936
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ public final void initializeJavacOpts() {
/** Computes javacopts for the current rule. */
private ImmutableList<String> computeJavacOpts(Collection<String> extraRuleJavacOpts) {
return ImmutableList.<String>builder()
.addAll(javaToolchain.getJavacOptions(ruleContext))
.addAll(javaToolchain.getJavacOptions())
.addAll(extraRuleJavacOpts)
.addAll(computePerPackageJavacOpts(ruleContext, javaToolchain))
.addAll(ruleContext.getExpander().withDataLocations().tokenized("javacopts"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static JavaPackageConfigurationProvider create(
public boolean matches(Label label) {
// Do not use streams here as they create excessive garbage.
for (PackageSpecificationProvider provider : packageSpecifications()) {
for (PackageGroupContents specifications : provider.getPackageSpecifications().toList()) {
for (PackageGroupContents specifications : provider.getPackageSpecifications()) {
if (specifications.containsPackage(label.getPackageIdentifier())) {
return true;
}
Expand Down

0 comments on commit 9b12936

Please sign in to comment.