mirror of
https://git.zx2c4.com/cgit
synced 2025-08-03 09:34:43 +02:00
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>
This commit is contained in:
parent
54272e6096
commit
8813170390
3 changed files with 14 additions and 4 deletions
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue