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>
Tá an tiomantas seo le fáil i:
Lars Hjemli
2008-11-29 16:46:37 +01:00
tuismitheoir 54272e6096
tiomantas 8813170390
D'athraigh 3 comhad le 14 breiseanna agus 4 scriosta

Féach ar an gComhad

@ -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;
}