commit - 1943de014775b966dbd5307f839f666123bb26f1
commit + 4307e57760075c91b0b75b4cfa4fcf57d4c87c2d
blob - f25073b2d2020fd56df8a7a70de65ce9d55f481c
blob + 5d18ab9204e793b414887aae3385588eef6a01a0
--- lib/got_lib_repository.h
+++ lib/got_lib_repository.h
#define GOT_PACKIDX_CACHE_SIZE 64
#define GOT_PACK_CACHE_SIZE GOT_PACKIDX_CACHE_SIZE
-#define GOT_OBJECT_CACHE_SIZE 8192
+#define GOT_OBJECT_CACHE_SIZE_OBJ 8192
+#define GOT_OBJECT_CACHE_SIZE_TREE 4096
+#define GOT_OBJECT_CACHE_SIZE_COMMIT 2048
enum got_object_chache_type {
GOT_OBJECT_CACHE_TYPE_OBJ,
struct got_object_cache {
enum got_object_chache_type type;
struct got_object_idset *set;
+ size_t size;
int cache_hit;
int cache_miss;
};
blob - 73293f2c64aea38647a40355fd9003ca7cae5f77
blob + 098c270ca56ffcc6cda91bab3e75d621a15ae9e6
--- lib/repository.c
+++ lib/repository.c
int nelem;
nelem = got_object_idset_num_elements(cache->set);
- if (nelem >= GOT_OBJECT_CACHE_SIZE) {
+ if (nelem >= cache->size) {
err = got_object_idset_remove_random((void **)&ce,
cache->set);
if (err)
goto done;
}
repo->objcache.type = GOT_OBJECT_CACHE_TYPE_OBJ;
+ repo->objcache.size = GOT_OBJECT_CACHE_SIZE_OBJ;
repo->treecache.set = got_object_idset_alloc();
if (repo->treecache.set == NULL) {
goto done;
}
repo->treecache.type = GOT_OBJECT_CACHE_TYPE_TREE;
+ repo->treecache.size = GOT_OBJECT_CACHE_SIZE_TREE;
repo->commitcache.set = got_object_idset_alloc();
if (repo->commitcache.set == NULL) {
goto done;
}
repo->commitcache.type = GOT_OBJECT_CACHE_TYPE_COMMIT;
+ repo->commitcache.size = GOT_OBJECT_CACHE_SIZE_COMMIT;
repo->path = got_path_normalize(abspath);
if (repo->path == NULL) {