Skip to content

Commit 9843a5e

Browse files
committed
always order
1 parent 913d4a3 commit 9843a5e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/com/google/devtools/build/lib/query2/query/output/StreamedProtoOutputFormatter.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ public void processOutput(Iterable<Target> partialResult)
5959
StreamSupport.stream(partialResult.spliterator(), /* parallel= */ true)
6060
.map(this::toProto)
6161
.map(StreamedProtoOutputFormatter::writeDelimited)
62-
.forEach(this::writeToOutputStreamThreadSafe);
62+
// I imagine forEachOrdered hurts performance somewhat in some cases. While we may
63+
// not need to actually produce output in order, this code does not know whether
64+
// ordering was requested. So we just always write it in order, and hope performance
65+
// is OK.
66+
.forEachOrdered(this::writeToOutputStreamThreadSafe);
6367
} catch (WrappedIOException e) {
6468
throw e.getCause();
6569
} catch (WrappedInterruptedException e) {

0 commit comments

Comments
 (0)