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 5794b25bd96b2fd6d2bccb83f18d90a28930c5a4..43c35a56f79ab6e18a127f4a141329e71f6aa7a4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+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.
index 14893a4777df17ae9c6a882b9fb572edba682987..022ac5c2da7f3694db2033da1c2bb4f26a5f8c88 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 6b3f9dcbe689757848f399e0148ab9405383afcb..70bc28194a8fceef966f020ea41926c508e54b02 100644 (file)
@@ -14,6 +14,7 @@ list
 array-list
 linkedhash-list
 linked-list
+rbtreehash-list
 xalloc
 xmalloca
 fstrcmp