aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2016-07-25 14:43:53 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-07-26 09:29:52 +0000
commit1a1c7f6f25af3be17fc4f97a3308d54d70d74f23 (patch)
tree4d4a7bdac6503857b5f7676987db96150e29e794 /src/main/java/com/google/devtools/build
parent7326e15c113ecb9d43e7e091a1c427ea39e13914 (diff)
Optimize Rule.getLabels(void) to avoid ImmutableSortedSet.construct().
This is called only from Package$Builder.checkForInputOutputConflicts() which just wants the name of each input label; there's no need to sort or deduplicate. -- MOS_MIGRATED_REVID=128355375
Diffstat (limited to 'src/main/java/com/google/devtools/build')
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/Rule.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/packages/Rule.java b/src/main/java/com/google/devtools/build/lib/packages/Rule.java
index 77cc19db9b..02971e08bb 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/Rule.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/Rule.java
@@ -374,7 +374,14 @@ public final class Rule implements Target, DependencyFilter.AttributeInfoProvide
* Returns a new List instance containing all direct dependencies (all types).
*/
public Collection<Label> getLabels() {
- return getLabels(DependencyFilter.ALL_DEPS);
+ final List<Label> labels = Lists.newArrayList();
+ AggregatingAttributeMapper.of(this).visitLabels(new AttributeMap.AcceptsLabelAttribute() {
+ @Override
+ public void acceptLabelAttribute(Label label, Attribute attribute) {
+ labels.add(label);
+ }
+ });
+ return labels;
}
/**