Presize some collections at the core of ParallelEvaluator
We know what size these will be ahead of time, and they can get large,
presize since there's no reason not to. Also change arg type for related
methods to be Set since it's all we deal in and we know it will have
better performance on size than generic Iterable.
--
MOS_MIGRATED_REVID=101806154
diff --git a/src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java b/src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java
index a488d387..3c39e78 100644
--- a/src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java
+++ b/src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java
@@ -295,9 +295,9 @@
@Override
protected ImmutableMap<SkyKey, ValueOrUntypedException> getValueOrUntypedExceptions(
- Iterable<SkyKey> depKeys) {
+ Set<SkyKey> depKeys) {
checkActive();
- Set<SkyKey> keys = new LinkedHashSet<>();
+ Set<SkyKey> keys = Sets.newLinkedHashSetWithExpectedSize(depKeys.size());
for (SkyKey depKey : depKeys) {
// Canonicalize SkyKeys to save memory.
keys.add(KEY_CANONICALIZER.intern(depKey));