From: Eric S. Raymond Date: Sun, 14 Sep 2003 16:41:11 +0000 (+0000) Subject: Explain the optimization. X-Git-Tag: 1.6~22 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=a0aa0221243ab4637f56489106afaf35b8b0085f;p=comparator.git Explain the optimization. --- diff --git a/report.c b/report.c index 9d2a045..98feb91 100644 --- 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;