Tags: patch

I've determined with gprof that the slowdown is caused by 80% or more
of mutt's time being spent in thread.c:is_next_displayed().  The
following minimal patch improves mutt's limited threading display
speed from excruciating to merely painful.

Index: mutt-1.3.25/thread.c
--- mutt-1.3.25/thread.c.prev
+++ mutt-1.3.25/thread.c        Thu Jan  3 14:51:54 2002
@@ -203,5 +203,5 @@ void mutt_linearize_tree (CONTEXT *ctx, 
     }
 
-    nextdisp = 0;
+    nextdisp = -1;
 
     do
@@ -221,5 +221,5 @@ void mutt_linearize_tree (CONTEXT *ctx, 
        if (tree->fake_thread)
          pseudo = 1;
-       if (!nextdisp)
+       if (nextdisp < 0)
          nextdisp = is_next_displayed (ctx, tree);
        hdr = tree->message;
@@ -234,4 +234,6 @@ void mutt_linearize_tree (CONTEXT *ctx, 
          tree = tree->parent;
          hdr = tree->message;
+         if (nextdisp == 0)
+           nextdisp = -1;
 
          if (hdr || !option (OPTHIDEMISSING) || tree->child->next)
@@ -248,5 +250,5 @@ void mutt_linearize_tree (CONTEXT *ctx, 
        if (!tree)
          break;
-       if (!nextdisp)
+       if (nextdisp < 0)
          nextdisp = is_next_displayed (ctx, tree);
        if (tree->fake_thread)
@@ -256,4 +258,7 @@ void mutt_linearize_tree (CONTEXT *ctx, 
     }
     while (!(hdr || !option (OPTHIDEMISSING) || tree->child->next));
+
+    if (nextdisp < 0)
+      nextdisp = 0;
   }
 
-- 
Chip Salzenberg         - a.k.a.  -        <[EMAIL PROTECTED]>
         "It furthers one to have somewhere to go."

Reply via email to