On Mon, Nov 20, 2017 at 09:20:35AM -0500, Jeff King wrote:
> Out of curiosity, have you tried experimenting with any high-performance
> 3rd-party allocator libraries? I've often wondered if we could get a
> performance improvement from dropping in a new allocator, but was never
> able to measure any real benefit over glibc's ptmalloc2. The situation
> might be different on Windows, though (i.e., if the libc allocator isn't
> that great).
Just linking with tcmalloc, like:
diff --git a/Makefile b/Makefile
index ee9d5eb11e..4f299cd914 100644
--- a/Makefile
+++ b/Makefile
@@ -1018,7 +1018,7 @@ BUILTIN_OBJS += builtin/worktree.o
BUILTIN_OBJS += builtin/write-tree.o
GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB)
-EXTLIBS =
+EXTLIBS = -ltcmalloc
GIT_USER_AGENT = git/$(GIT_VERSION)
seems to consistently show about 30% speedup on p0002:
Test HEAD^ HEAD
--------------------------------------------------------------------------------------
0002.1: read_cache/discard_cache 1000 times 0.19(0.18+0.01) 0.13(0.12+0.01)
-31.6%
I don't think we really even need a patch for it. You should be able to
just build with:
make EXT_LIBS=-ltcmalloc
I can't think of any real advantage to a Makefile knob except
discoverability.
-Peff