From 8813170390f3c3a0f4743afbc92ede42953fa3b0 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sat, 29 Nov 2008 16:46:37 +0100 Subject: ui-repolist: implement lazy caching of repo->mtime When sorting the list of repositories by their last modification time, cgit would (in the worst case) invoke fstat(3) four times and open(3) twice for each callback from qsort(3). This obviously scales very badly. Now, the calculated modtime for each repo is saved in repo->mtime, thus keeping the number of stat/open invocations identical for sorted and unsorted repo-listings. Signed-off-by: Lars Hjemli --- shared.c | 1 + 1 file changed, 1 insertion(+) (limited to 'shared.c') diff --git a/shared.c b/shared.c index f5875e4..89d1bab 100644 --- a/shared.c +++ b/shared.c @@ -60,6 +60,7 @@ struct cgit_repo *cgit_add_repo(const char *url) ret->enable_log_linecount = ctx.cfg.enable_log_linecount; ret->module_link = ctx.cfg.module_link; ret->readme = NULL; + ret->mtime = -1; return ret; } -- cgit v1.2.3-70-g09d2