File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -757,14 +757,16 @@ fn duration_in_inner<'a>(
757
757
let state = state. materialize ( agg. states_as_str ( ) ) ;
758
758
let mut total = 0 ;
759
759
for tis in agg. combined_durations . iter ( ) {
760
- if tis. state . materialize ( agg. states_as_str ( ) ) == state {
761
- let tis_start_time = i64:: max ( tis. start_time , start) ;
762
- let tis_end_time = i64:: min ( tis. end_time , end) ;
763
- if tis_end_time >= start && tis_start_time <= end {
764
- let amount = tis_end_time - tis_start_time;
765
- assert ! ( amount >= 0 , "incorrectly ordered times" ) ;
766
- total += amount;
767
- }
760
+ let tis_start_time = i64:: max ( tis. start_time , start) ;
761
+ let tis_end_time = i64:: min ( tis. end_time , end) ;
762
+ if tis_start_time > end {
763
+ // combined_durations is sorted, so after this point there can't be any more
764
+ break ;
765
+ } ;
766
+ if tis_end_time >= start && tis. state . materialize ( agg. states_as_str ( ) ) == state {
767
+ let amount = tis_end_time - tis_start_time;
768
+ assert ! ( amount >= 0 , "incorrectly ordered times" ) ;
769
+ total += amount;
768
770
}
769
771
}
770
772
total
You can’t perform that action at this time.
0 commit comments