Skip to content

Commit 28de2ed

Browse files
committed
Break early out of metrics calculation due to sorted frames
1 parent 71cdcdb commit 28de2ed

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

flutter/lib/src/span_frame_metrics_collector.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ class SpanFrameMetricsCollector implements PerformanceContinuousCollector {
202202
final fullFrameDelay = max(0, frameDuration - expectedFrameDuration);
203203
final intersectionRatio = effectiveDuration / frameDuration;
204204
effectiveDelay = (fullFrameDelay * intersectionRatio).round();
205+
} else if (frameStartMs > spanEndMs) {
206+
// Other frames will be newer than this span, as frames are ordered
207+
break;
205208
} else {
206209
// Frame is completely outside the span, skip it
207210
continue;

0 commit comments

Comments
 (0)