Commit 159a21e5a66248bba48b1b665ff4c2c3c61b2240

Stefan Sperling 2021-03-30T00:48:38

increase pack index cache size from 16 to 64 to improve performance This can make a huge difference on repositories which contain more than 16 pack files, at the expense of additional open file handles. My test case was a ports.git repository with > 60 pack files (these accumulate due to 'got fetch', and 'git repack -a' would condense them). With cache size 16 'got update' in /usr/ports took more than 60 seconds. With cache size 64 the same command took less than 5 seconds. The root cause is probably that mapping and unmapping large files over and over again is expensive on OpenBSD.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/lib/got_lib_repository.h b/lib/got_lib_repository.h
index 18d2953..926534b 100644
--- a/lib/got_lib_repository.h
+++ b/lib/got_lib_repository.h
@@ -28,7 +28,7 @@
 #define GOT_OBJECTS_PACK_DIR	"objects/pack"
 #define GOT_PACKED_REFS_FILE	"packed-refs"
 
-#define GOT_PACKIDX_CACHE_SIZE	16
+#define GOT_PACKIDX_CACHE_SIZE	64
 #define GOT_PACK_CACHE_SIZE	GOT_PACKIDX_CACHE_SIZE
 
 struct got_repository {