[PR #2774] [MERGED] Add commit count caching #16584

Closed
opened 2025-11-02 12:14:01 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/2774
Author: @lafriks
Created: 10/23/2017
Status: Merged
Merged: 10/26/2017
Merged by: @lunny

Base: masterHead: feat/add_caching


📝 Commits (5)

  • d3bb548 Add commit count caching
  • 2aa90de Small refactoring
  • 89b8156 Add different key prefix for refs and commits
  • faaf672 Add configuratuion option to allow to change caching time or disable it
  • fcc0bef Merge branch 'master' into feat/add_caching

📊 Changes

10 files changed (+150 additions, -25 deletions)

View changed files

📝 conf/app.ini (+3 -0)
📝 models/repo.go (+11 -0)
📝 models/update.go (+10 -3)
modules/cache/cache.go (+72 -0)
📝 modules/context/repo.go (+19 -2)
📝 modules/setting/setting.go (+22 -10)
📝 routers/admin/admin.go (+3 -3)
📝 routers/init.go (+3 -0)
📝 routers/repo/commit.go (+2 -2)
📝 routers/routes/routes.go (+5 -5)

📄 Description

Especially on large repositories like linux kernel getting commit count from git takes more or less 7 seconds, so let's cache it as commit count is needed on every repository page load.

For linux kernel repository (more then 700K commits) it brings down repository page load time from 11.5 seconds to 3.3 seconds on my development machine.

[Macaron] 2017-10-24 16:50:25: Started GET /user1/linux for [::1]
[Macaron] 2017-10-24 16:50:36: Completed /user1/linux 200 OK in 11.4833512s
[Macaron] 2017-10-24 16:50:56: Started GET /user1/linux for [::1]
[Macaron] 2017-10-24 16:50:59: Completed /user1/linux 200 OK in 3.2968169s

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-gitea/gitea/pull/2774 **Author:** [@lafriks](https://github.com/lafriks) **Created:** 10/23/2017 **Status:** ✅ Merged **Merged:** 10/26/2017 **Merged by:** [@lunny](https://github.com/lunny) **Base:** `master` ← **Head:** `feat/add_caching` --- ### 📝 Commits (5) - [`d3bb548`](https://github.com/go-gitea/gitea/commit/d3bb5483d40ee49d1ddd8e365134dd4e08c3d93d) Add commit count caching - [`2aa90de`](https://github.com/go-gitea/gitea/commit/2aa90de01de409e4df82ac4ca8d5c167fb1c30ee) Small refactoring - [`89b8156`](https://github.com/go-gitea/gitea/commit/89b81568d9dee555161dcee56d3832519209c522) Add different key prefix for refs and commits - [`faaf672`](https://github.com/go-gitea/gitea/commit/faaf67213a650d079a80b4b231cdb6ac00ed88ab) Add configuratuion option to allow to change caching time or disable it - [`fcc0bef`](https://github.com/go-gitea/gitea/commit/fcc0bef0644bc0238f23c9fb1d27b98e7b33cfda) Merge branch 'master' into feat/add_caching ### 📊 Changes **10 files changed** (+150 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `conf/app.ini` (+3 -0) 📝 `models/repo.go` (+11 -0) 📝 `models/update.go` (+10 -3) ➕ `modules/cache/cache.go` (+72 -0) 📝 `modules/context/repo.go` (+19 -2) 📝 `modules/setting/setting.go` (+22 -10) 📝 `routers/admin/admin.go` (+3 -3) 📝 `routers/init.go` (+3 -0) 📝 `routers/repo/commit.go` (+2 -2) 📝 `routers/routes/routes.go` (+5 -5) </details> ### 📄 Description Especially on large repositories like linux kernel getting commit count from git takes more or less 7 seconds, so let's cache it as commit count is needed on every repository page load. For linux kernel repository (more then 700K commits) it brings down repository page load time from 11.5 seconds to 3.3 seconds on my development machine. ``` [Macaron] 2017-10-24 16:50:25: Started GET /user1/linux for [::1] [Macaron] 2017-10-24 16:50:36: Completed /user1/linux 200 OK in 11.4833512s [Macaron] 2017-10-24 16:50:56: Started GET /user1/linux for [::1] [Macaron] 2017-10-24 16:50:59: Completed /user1/linux 200 OK in 3.2968169s ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-02 12:14:01 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#16584