Skip to content

Commit df58a70

Browse files
committed
Using forEach to avoid Iterator allocation
1 parent 6f14285 commit df58a70

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

dd-trace-core/src/main/java/datadog/trace/core/CoreTracer.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,9 +1230,10 @@ void write(final List<DDSpan> trace) {
12301230

12311231
// run early tag postprocessors before publishing to the metrics writer since peer / base
12321232
// service are needed
1233-
for (DDSpan span : writtenTrace) {
1234-
span.processServiceTags();
1235-
}
1233+
1234+
// DQH - Using forEach avoids ArrayList$Iter allocation
1235+
writtenTrace.forEach(DDSpan::processServiceTags);
1236+
12361237
boolean forceKeep = metricsAggregator.publish(writtenTrace);
12371238

12381239
TraceCollector traceCollector = writtenTrace.get(0).context().getTraceCollector();

0 commit comments

Comments
 (0)