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>
这个提交包含在:
Lars Hjemli
2008-11-29 16:46:37 +01:00
父节点 54272e6096
当前提交 8813170390
修改 3 个文件,包含 14 行新增4 行删除

1
cgit.h
查看文件

@@ -61,6 +61,7 @@ struct cgit_repo {
int snapshots;
int enable_log_filecount;
int enable_log_linecount;
time_t mtime;
};
struct cgit_repolist {