-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add directory paging for rendering code trees #16432
Add directory paging for rendering code trees #16432
Conversation
This PR simply adds the ability to make directory rendering be paged. Coupled with the previous improvements to last commit info generation this should speed up directory rendering for large repositories. Signed-off-by: Andrew Thornton <art27@cantab.net>
This comment has been minimized.
This comment has been minimized.
Imho we should reconsider take on this, we shoud make entry list commit info as async instead of paging, or at least make paging larger like at least 100 + async commit info |
You mean #16467? The directories need to paged anyway. Consider this tree: https://cgit.freebsd.org/ports/tree/devel It's insane and even #16467 is slightly pathological for it because the javascript looking for the missing commits is quite slow due to the insane number of items it needs to generate commit information for.
Is that a bad idea? 63 items is kinda long to scroll past to get to the README. I chose 50 because there is a genuine performance improvement below 70 items and the UI doesn't feel too restrictive. Generating last commit info for more than 70 means walking and generating all the last commit information (until you get below 70 items) because git's internal algorithm for shortcutting commits starts to fail at that point. That means that on large repositories every page would get the same initial delay. (The 70 number comes from: gitea/modules/git/log_name_status.go Line 32 in e76f8ca
Feel free to play with that number there and a copy of git.git and ports.git. ) If you really want this to be 100 instead of 50 then to get a performance improvement from it we're going to have to change the algorithm to cache everything it sees up to the point it can start shortcutting. Otherwise this would actually represent an increase in load and likely a worsening of performance. Changing the algorithm to cache everything it is seeing up to the point that it can start shortcutting whilst possible would require passing in two sets of information in to WalkGitLog. gitea/modules/git/log_name_status.go Line 270 in e76f8ca
The most performant solution would be to:
|
I like the idear but it does not speed up the view - somehow each page does refill commit cache on first hit |
Signed-off-by: Andrew Thornton <art27@cantab.net>
The circumstances in which this will definitely improve last commit cache performance would be dependent on a few factors. The best improvement would be on pages that do not contain the pathological cases for the caching algorithm, that is long unchanged tree entries. If these are spread throughout the pages this PR won't help and if anything will make it worse.
? I don't understand what you mean. If it's what I think you're implying that kind of thing would need the comments in #16432 (comment) implemented. #16467 is the real significant performance improvement - not this. |
Yes I meant that PR but had no time to look at it in details yet. 50 is not that much imho and while it helps performance it hurts usability. I don't think we need to sacrifice usability for large number of repositories to gain performance on very small number of extreme cases. We need to balance it carefully. |
Signed-off-by: Andrew Thornton <art27@cantab.net>
solved? |
Well, let me put it this way: Could it be that Gitea is a large repository? In the end, it comes down to how "aesthetic" we want to be: There is only one potential problem I can foresee: What do you do if the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding my prior comment:
My fear towards the README not being displayed seems not to be a problem.
@@ -1011,6 +1011,9 @@ PATH = | |||
;; Number of issues that are displayed on one page | |||
;ISSUE_PAGING_NUM = 10 | |||
;; | |||
;; Number of entries are displayed on code rendering page |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
;; Number of entries are displayed on code rendering page | |
;; Number of entries displayed on file tree pages | |
;; Big enough repositories will load significantly slower if the value is >= 70 |
@@ -169,6 +169,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a | |||
- `EXPLORE_PAGING_NUM`: **20**: Number of repositories that are shown in one explore page. | |||
- `ISSUE_PAGING_NUM`: **10**: Number of issues that are shown in one page (for all pages that list issues). | |||
- `MEMBERS_PAGING_NUM`: **20**: Number of members that are shown in organization members. | |||
- `DIRECTORY_PAGING_NUM`: **50**: Number of directory entries that are shown in one page. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `DIRECTORY_PAGING_NUM`: **50**: Number of directory entries that are shown in one page. | |
- `DIRECTORY_PAGING_NUM`: **50**: Number of directory entries that are shown in one page. Setting the value >= 70 will slow down loading big enough repositories significantly. |
pageSize := setting.UI.DirectoryPagingNum | ||
|
||
if pageSize > 1 { | ||
pager := context.NewPagination(len(entries), pageSize, page, 5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the 5?
What does that do?
Is that perhaps the number of page literals to show?
Oh, one thing is unclear to me: |
@zeripath can you resolve conflict :) |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 months. Thank you for your contributions. |
This PR simply adds the ability to make directory rendering be paged.
Coupled with the previous improvements to last commit info generation
this should speed up directory rendering for large repositories.
Signed-off-by: Andrew Thornton art27@cantab.net