Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Slowdown around 5.0.5-dev-0



On Oct 24,  9:37am, Sebastian Gniazdowski wrote:
}
} So the thing is that your patch from yesterday retains search_test
} speed up of 36834, while fixing the memory issues of 36834. Together
} with 36836, this gives full retain of search_test speedup, nothing is
} lost, speed of pattern matching is as high as with no revert from
} current head state. What's lost is string_test speedup 36834 gave,
} however, it did so with cost of increased memory usage

OK, let's try it this way.  This retains MOST of 36834, but puts back
scanning the entire heap if we intend to free the block to which the
current fheap pointer refers.

(This is a patch against 8e9a68ad but applies to current head.)


diff --git a/Src/mem.c b/Src/mem.c
index 68bd767..ca9ab96 100644
--- a/Src/mem.c
+++ b/Src/mem.c
@@ -343,6 +343,12 @@ freeheap(void)
      * we reach popheap().  This may fail to reclaim some space in earlier
      * arenas.
      *
+     * However, if the arena to which fheap points is unused, we want to
+     * free it, so we have no choice but to do the sweep for a new fheap.
+     */
+    if (fheap && !fheap->sp)
+       fheap = NULL;   /* We used to do this unconditionally */
+    /*
      * In other cases, either fheap is already correct, or it has never
      * been set and this loop will do it, or it'll be reset from scratch
      * on the next popheap().  So all that's needed here is to pick up


Here are my results for that; memory usage is comparable to 36926 while
speed is improved.

Running [zsh-HEAD]:                      string_test      23203.72
Running [zsh-36926]:                     string_test      38478.23
Running [zsh-HEAD+rescan]:               string_test      28787.44

Running [zsh-HEAD]:                      array_test        6261.07
Running [zsh-36926]:                     array_test        6269.27
Running [zsh-HEAD+rescan]:               array_test        6269.94

Running [zsh-HEAD]:                      function_test    29609.59
Running [zsh-36926]:                     function_test    30133.26
Running [zsh-HEAD+rescan]:               function_test    30237.71

Running [zsh-HEAD]:                      search_test       4209.37
Running [zsh-36926]:                     search_test       4194.97
Running [zsh-HEAD+rescan]:               search_test       4260.73



Messages sorted by: Reverse Date, Date, Thread, Author