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 <hjemli@gmail.com>
Esse commit está contido em:
1
shared.c
1
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;
|
||||
}
|
||||
|
||||
|
Referência em uma nova issue
Block a user