]> thyrsus.com Git - comparator.git/commitdiff
Explain the optimization.
authorEric S. Raymond <esr@thyrsus.com>
Sun, 14 Sep 2003 16:41:11 +0000 (16:41 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Sun, 14 Sep 2003 16:41:11 +0000 (16:41 +0000)
report.c

index 9d2a045f8f23a39a3de62b5e40fc7b654a88f10f..98feb917f91b3c082392474691e6f1b02ed8704d 100644 (file)
--- a/report.c
+++ b/report.c
@@ -139,6 +139,12 @@ static int collapse_ranges(struct match_t *reduced, int nonuniques)
     {
        int remaining;
 
+       /*
+        * This optimization drastically reduces the number of compare_files
+        * calls.  The continue condition in the inner loop below would 
+        * otherwise involve one every time for O(n**2) calls; this reduces
+        * the number to O(n).
+        */
        if (spancount <= 0)
        {
            spancount = 0;