@@ -105,11 +105,9 @@ impl<B> Compactor<B> {
105105 let start_frame_no: u64 = row. get ( 0 ) ?;
106106 let end_frame_no: u64 = row. get ( 1 ) ?;
107107 let timestamp: u64 = row. get ( 2 ) ?;
108- // it's free to go from one end of a segment to the next
109- graph. add_edge ( start_frame_no, end_frame_no, 0 ) ;
108+ graph. add_edge ( start_frame_no, end_frame_no, timestamp) ;
110109 if start_frame_no != 1 {
111- // going from a segment to the next costs us
112- graph. add_edge ( start_frame_no - 1 , start_frame_no, timestamp) ;
110+ graph. add_edge ( start_frame_no - 1 , start_frame_no, 0 ) ;
113111 }
114112 last_frame_no = last_frame_no. max ( end_frame_no) ;
115113 }
@@ -368,7 +366,10 @@ impl AnalyzedSegments {
368366 & self . graph ,
369367 1 ,
370368 |n| n == self . last_frame_no ,
371- |( _, _, & x) | x,
369+ // it's always free to go from one end of the segment to the other, and it costs us to
370+ // fetch a new segment. edges between segments are always 0, and edges within segments
371+ // are the segment timestamp
372+ |( _, _, & x) | if x == 0 { 1 } else { 0 } ,
372373 |n| self . last_frame_no - n,
373374 ) ;
374375 let mut segments = Vec :: new ( ) ;
@@ -383,6 +384,7 @@ impl AnalyzedSegments {
383384 end_frame_no,
384385 timestamp,
385386 } ;
387+ dbg ! ( & key) ;
386388 segments. push ( key) ;
387389 }
388390 }
0 commit comments