author | Lars Hjemli <hjemli@gmail.com> | 2008-11-29 15:46:37 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-11-29 15:46:37 (UTC) |
commit | 8813170390f3c3a0f4743afbc92ede42953fa3b0 (patch) (side-by-side diff) | |
tree | 39305350baee1eb564aae00294634bbe544983d3 /cgit.h | |
parent | 54272e60965ec6a98b49cbf67d72a4b1f5adc55b (diff) | |
download | cgit-8813170390f3c3a0f4743afbc92ede42953fa3b0.zip cgit-8813170390f3c3a0f4743afbc92ede42953fa3b0.tar.gz cgit-8813170390f3c3a0f4743afbc92ede42953fa3b0.tar.bz2 |
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>
-rw-r--r-- | cgit.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -52,24 +52,25 @@ struct cgit_repo { char *name; char *path; char *desc; char *owner; char *defbranch; char *group; char *module_link; char *readme; char *clone_url; int snapshots; int enable_log_filecount; int enable_log_linecount; + time_t mtime; }; struct cgit_repolist { int length; int count; struct cgit_repo *repos; }; struct commitinfo { struct commit *commit; char *author; char *author_email; |