Speed up from O(n^2) to O(n).
authorBruno Haible <bruno@clisp.org>
Mon, 18 Feb 2008 01:41:03 +0000 (02:41 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 18 Feb 2008 01:41:03 +0000 (02:41 +0100)
ChangeLog
lib/git-merge-changelog.c
modules/git-merge-changelog

index 5794b25..43c35a5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2008-02-17  Bruno Haible  <bruno@clisp.org>
 
+       Speed up from O(n^2) to O(n) for long ChangeLog files.
+       * lib/git-merge-changelog.c: Include gl_rbtreehash_list.h.
+       (read_changelog_file): Change implementation of entries_reversed list
+       to rbtreehash.
+       * modules/git-merge-changelog (Depends-on): Add rbtreehash-list.
+
+2008-02-17  Bruno Haible  <bruno@clisp.org>
+
        New option --split-merged-entry.
        * lib/git-merge-changelog.c (FSTRCMP_STRICTER_THRESHOLD): New macro.
        (find_paragraph_end, try_split_merged_entry): New functions.
index 14893a4..022ac5c 100644 (file)
 #include "gl_list.h"
 #include "gl_array_list.h"
 #include "gl_linkedhash_list.h"
+#include "gl_rbtreehash_list.h"
 #include "gl_linked_list.h"
 #include "xalloc.h"
 #include "xmalloca.h"
@@ -248,7 +249,7 @@ read_changelog_file (const char *filename, struct changelog_file *result)
     gl_list_create_empty (GL_LINKEDHASH_LIST, entry_equals, entry_hashcode,
                          NULL, true);
   result->entries_reversed =
-    gl_list_create_empty (GL_LINKEDHASH_LIST, entry_equals, entry_hashcode,
+    gl_list_create_empty (GL_RBTREEHASH_LIST, entry_equals, entry_hashcode,
                          NULL, true);
   /* A ChangeLog file consists of ChangeLog entries.  A ChangeLog entry starts
      at a line following a blank line and that starts with a non-whitespace
index 6b3f9dc..70bc281 100644 (file)
@@ -14,6 +14,7 @@ list
 array-list
 linkedhash-list
 linked-list
+rbtreehash-list
 xalloc
 xmalloca
 fstrcmp