Diff
Not logged in

Differences From:

File tools/cvs2fossil/lib/c2f_prev.tcl part of check-in [530168ec30] - Split internals of breakinternaldependencies into more manageable pieces in prep for upcoming work on the handling of pseudo-dependencies. by aku on 2008-02-23 20:18:35. [view]

To:

File tools/cvs2fossil/lib/c2f_prev.tcl part of check-in [59b54efab5] - Changed the encoding of the values stored in DEPC. Keep only start/end of the range, not the list of all positions in it. That caused the memory-blowup. by aku on 2008-02-24 00:14:21. [view]

@@ -853,19 +853,18 @@
 	    foreach child $children {
 		set dkey    [list $rid $child]
 		set start   $pos($rid)
 		set end     $pos($child)
-		set crosses {}
 
 		if {$start > $end} {
-		    while {$end < $start} {
-			lappend crosses $end
+		    set crosses [list $end [expr {$start-1}]]
+		    while {$end < $start} {
 			incr cross($end)
 			incr end
 		    }
 		} else {
-		    while {$start < $end} {
-			lappend crosses $start
+		    set crosses [list $start [expr {$end-1}]]
+		    while {$start < $end} {
 			incr cross($start)
 			incr start
 		    }
 		}
@@ -975,9 +974,16 @@
 	# data when we look at the generated fragments.
 
 	set six [log visible? 6]
 
-	foreach {dep range} [array get depc] {
+	# Note: The loop below could be made faster by keeping a map
+	# from positions to the dependencies crossing. An extension of
+	# CROSS, i.e. list of dependencies, counter is implied. Takes
+	# a lot more memory however, and takes time to update here
+	# (The inner loop is not incr -1, but ldelete).
+
+	foreach dep [array names depc] {
+	    set range $depc($dep)
 	    # Check all dependencies still known, take their range and
 	    # see if the break location falls within.
 
 	    Border $range s e
@@ -987,9 +993,12 @@
 	    # This dependency crosses the break location. We remove it
 	    # from the crossings counters, and then also from the set
 	    # of known dependencies, as we are done with it.
 
-	    foreach loc $depc($dep) { incr cross($loc) -1 }
+	    Border $depc($dep) ds de
+	    for {set loc $ds} {$loc <= $de} {incr loc} {
+		incr cross($loc) -1
+	    }
 	    unset depc($dep)
 
 	    if {!$six} continue