Skip to content
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

Simplify split diff view generation and remove JS dependency #16775

Merged
merged 8 commits into from
Aug 29, 2021

Conversation

zeripath
Copy link
Contributor

@zeripath zeripath commented Aug 23, 2021

Gitea has relied on some slow JS code to match up added and deleted lines on the
diff pages. This can cause a considerable slow down on large diff pages.

This PR makes a small change meaning that the matching up can occur much more simply.

Partial fix #1351

Signed-off-by: Andrew Thornton art27@cantab.net

@zeripath zeripath added type/bug performance/speed performance issues with slow downs backport/v1.15 labels Aug 23, 2021
@zeripath zeripath added this to the 1.16.0 milestone Aug 23, 2021
@zeripath
Copy link
Contributor Author

zeripath commented Aug 23, 2021

have marked this backport as I think it's small enough and enough of an improvement that we should be better off for it.

The places to double check this for errors and down grades are going to be in the comments I think. (Fixed and double checked.)

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 23, 2021
Gitea has relied on some slow JS code to match up added and deleted lines on the
diff pages. This can cause a considerable slow down on large diff pages.

This PR makes a small change meaning that the matching up can occur much more simply.

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath zeripath force-pushed the simplify-split-view-generation branch from 82d7865 to 1e92cbb Compare August 23, 2021 00:18
@silverwind
Copy link
Member

Nice! Should this also speed up the regular (unified) diff, or only the split diff?

@silverwind
Copy link
Member

Nevermind, I see script only loaded when .IsSplitStyle, so it should only affect split.

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath zeripath changed the title Simpliy split diff view generation and remove JS dependency Simplify split diff view generation and remove JS dependency Aug 23, 2021
@zeripath
Copy link
Contributor Author

Nevermind, I see script only loaded when .IsSplitStyle, so it should only affect split.

Yup split only. But split is the default and so I think on large diffs this JS may even be the cause of the bulk of the serious slowdowns.

(One other place that might be causing serious issues might be getting all the branches for the various repos that can prs can be made to.)

@codecov-commenter
Copy link

codecov-commenter commented Aug 23, 2021

Codecov Report

Merging #16775 (e1ba0f4) into main (ba6baff) will decrease coverage by 0.00%.
The diff coverage is 50.39%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #16775      +/-   ##
==========================================
- Coverage   45.45%   45.45%   -0.01%     
==========================================
  Files         762      762              
  Lines       86027    86099      +72     
==========================================
+ Hits        39107    39138      +31     
- Misses      40604    40651      +47     
+ Partials     6316     6310       -6     
Impacted Files Coverage Δ
models/repo.go 54.77% <ø> (ø)
modules/markup/external/external.go 1.61% <0.00%> (-0.12%) ⬇️
routers/web/org/members.go 0.00% <0.00%> (ø)
routers/web/org/teams.go 0.00% <0.00%> (ø)
routers/web/repo/milestone.go 0.00% <0.00%> (ø)
routers/web/user/profile.go 41.27% <0.00%> (-0.18%) ⬇️
services/auth/oauth2.go 48.52% <0.00%> (ø)
routers/web/repo/release.go 26.51% <50.00%> (+0.13%) ⬆️
modules/repository/fork.go 48.38% <75.00%> (ø)
routers/web/user/oauth.go 37.47% <76.47%> (+0.14%) ⬆️
... and 22 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d24eb6e...e1ba0f4. Read the comment docs.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Aug 26, 2021
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Aug 29, 2021
@zeripath zeripath merged commit f5b0e2c into go-gitea:main Aug 29, 2021
@zeripath zeripath deleted the simplify-split-view-generation branch August 29, 2021 14:28
zeripath added a commit to zeripath/gitea that referenced this pull request Aug 29, 2021
…a#16775)

Backport go-gitea#16775

Gitea has relied on some slow JS code to match up added and deleted lines on the
diff pages. This can cause a considerable slow down on large diff pages.

This PR makes a small change meaning that the matching up can occur much more simply.

Partial fix go-gitea#1351

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath zeripath added the backport/done All backports for this PR have been created label Aug 29, 2021
zeripath added a commit that referenced this pull request Aug 30, 2021
…#16863)

Backport #16775

Gitea has relied on some slow JS code to match up added and deleted lines on the
diff pages. This can cause a considerable slow down on large diff pages.

This PR makes a small change meaning that the matching up can occur much more simply.

Partial fix #1351

Signed-off-by: Andrew Thornton <art27@cantab.net>
zeripath added a commit to zeripath/gitea that referenced this pull request Sep 2, 2021
## [1.15.1](https://github.com/go-gitea/gitea/releases/tag/v1.15.1) - 2021-09-02

* BUGFIXES
  * Allow BASIC authentication access to /:owner/:repo/releases/download/* (go-gitea#16916) (go-gitea#16923)
  * Prevent leave changes dialogs due to autofill fields (go-gitea#16912) (go-gitea#16920)
  * Ignore review comment when ref commit is missed (go-gitea#16905) (go-gitea#16919)
  * Fix wrong attachment removal (go-gitea#16915) (go-gitea#16917)
  * Gitlab Migrator: dont ignore reactions of last request (go-gitea#16903) (go-gitea#16913)
  * Correctly return the number of Repositories for Organizations (go-gitea#16807) (go-gitea#16911)
  * Test if LFS object is accessible (go-gitea#16865) (go-gitea#16904)
  * Fix git.Blob.DataAsync(): close pipe since we return a NopCloser (go-gitea#16899) (go-gitea#16900)
  * Fix dump and restore respository (go-gitea#16698) (go-gitea#16898)
  * Repare and Improve GetDiffRangeWithWhitespaceBehavior (go-gitea#16894) (go-gitea#16895)
  * Fix wiki raw commit diff/patch view (go-gitea#16891) (go-gitea#16892)
  * Ensure wiki repos are all closed (go-gitea#16886) (go-gitea#16888)
  * List limited and private orgs if authenticated on API (go-gitea#16866) (go-gitea#16879)
  * Simplify split diff view generation and remove JS dependency (go-gitea#16775) (go-gitea#16863)
  * Ensure that the default visibility is set on the user create page (go-gitea#16845) (go-gitea#16862)
  * In Render tolerate not being passed a context (go-gitea#16842) (go-gitea#16858)
  * Upgrade xorm to v1.2.2 (go-gitea#16663) & Add test to ensure that dumping of login sources remains correct (go-gitea#16847) (go-gitea#16848)
  * Report the correct number of pushes on the feeds (go-gitea#16811) (go-gitea#16822)
  * Add primary_key to issue_index (go-gitea#16813) (go-gitea#16820)
  * Prevent NPE on empty commit (go-gitea#16812) (go-gitea#16819)
  * Fix branch pagination error (go-gitea#16805) (go-gitea#16816)
  * Add missing return to handleSettingRemoteAddrError (go-gitea#16794) (go-gitea#16795)
  * Remove spurious / from issues.opened_by (go-gitea#16793)
  * Ensure that template compilation panics are sent to the logs (go-gitea#16788) (go-gitea#16792)
  * Update caddyserver/certmagic (go-gitea#16789) (go-gitea#16790)

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath zeripath mentioned this pull request Sep 2, 2021
zeripath added a commit that referenced this pull request Sep 2, 2021
## [1.15.1](https://github.com/go-gitea/gitea/releases/tag/v1.15.1) - 2021-09-02

* BUGFIXES
  * Allow BASIC authentication access to /:owner/:repo/releases/download/* (#16916) (#16923)
  * Prevent leave changes dialogs due to autofill fields (#16912) (#16920)
  * Ignore review comment when ref commit is missed (#16905) (#16919)
  * Fix wrong attachment removal (#16915) (#16917)
  * Gitlab Migrator: dont ignore reactions of last request (#16903) (#16913)
  * Correctly return the number of Repositories for Organizations (#16807) (#16911)
  * Test if LFS object is accessible (#16865) (#16904)
  * Fix git.Blob.DataAsync(): close pipe since we return a NopCloser (#16899) (#16900)
  * Fix dump and restore respository (#16698) (#16898)
  * Repare and Improve GetDiffRangeWithWhitespaceBehavior (#16894) (#16895)
  * Fix wiki raw commit diff/patch view (#16891) (#16892)
  * Ensure wiki repos are all closed (#16886) (#16888)
  * List limited and private orgs if authenticated on API (#16866) (#16879)
  * Simplify split diff view generation and remove JS dependency (#16775) (#16863)
  * Ensure that the default visibility is set on the user create page (#16845) (#16862)
  * In Render tolerate not being passed a context (#16842) (#16858)
  * Upgrade xorm to v1.2.2 (#16663) & Add test to ensure that dumping of login sources remains correct (#16847) (#16848)
  * Report the correct number of pushes on the feeds (#16811) (#16822)
  * Add primary_key to issue_index (#16813) (#16820)
  * Prevent NPE on empty commit (#16812) (#16819)
  * Fix branch pagination error (#16805) (#16816)
  * Add missing return to handleSettingRemoteAddrError (#16794) (#16795)
  * Remove spurious / from issues.opened_by (#16793)
  * Ensure that template compilation panics are sent to the logs (#16788) (#16792)
  * Update caddyserver/certmagic (#16789) (#16790)

Signed-off-by: Andrew Thornton <art27@cantab.net>
zeripath added a commit to zeripath/gitea that referenced this pull request Sep 2, 2021
## [1.15.1](https://github.com/go-gitea/gitea/releases/tag/v1.15.1) - 2021-09-02

* BUGFIXES
  * Allow BASIC authentication access to /:owner/:repo/releases/download/* (go-gitea#16916) (go-gitea#16923)
  * Prevent leave changes dialogs due to autofill fields (go-gitea#16912) (go-gitea#16920)
  * Ignore review comment when ref commit is missed (go-gitea#16905) (go-gitea#16919)
  * Fix wrong attachment removal (go-gitea#16915) (go-gitea#16917)
  * Gitlab Migrator: dont ignore reactions of last request (go-gitea#16903) (go-gitea#16913)
  * Correctly return the number of Repositories for Organizations (go-gitea#16807) (go-gitea#16911)
  * Test if LFS object is accessible (go-gitea#16865) (go-gitea#16904)
  * Fix git.Blob.DataAsync(): close pipe since we return a NopCloser (go-gitea#16899) (go-gitea#16900)
  * Fix dump and restore respository (go-gitea#16698) (go-gitea#16898)
  * Repare and Improve GetDiffRangeWithWhitespaceBehavior (go-gitea#16894) (go-gitea#16895)
  * Fix wiki raw commit diff/patch view (go-gitea#16891) (go-gitea#16892)
  * Ensure wiki repos are all closed (go-gitea#16886) (go-gitea#16888)
  * List limited and private orgs if authenticated on API (go-gitea#16866) (go-gitea#16879)
  * Simplify split diff view generation and remove JS dependency (go-gitea#16775) (go-gitea#16863)
  * Ensure that the default visibility is set on the user create page (go-gitea#16845) (go-gitea#16862)
  * In Render tolerate not being passed a context (go-gitea#16842) (go-gitea#16858)
  * Upgrade xorm to v1.2.2 (go-gitea#16663) & Add test to ensure that dumping of login sources remains correct (go-gitea#16847) (go-gitea#16848)
  * Report the correct number of pushes on the feeds (go-gitea#16811) (go-gitea#16822)
  * Add primary_key to issue_index (go-gitea#16813) (go-gitea#16820)
  * Prevent NPE on empty commit (go-gitea#16812) (go-gitea#16819)
  * Fix branch pagination error (go-gitea#16805) (go-gitea#16816)
  * Add missing return to handleSettingRemoteAddrError (go-gitea#16794) (go-gitea#16795)
  * Remove spurious / from issues.opened_by (go-gitea#16793)
  * Ensure that template compilation panics are sent to the logs (go-gitea#16788) (go-gitea#16792)
  * Update caddyserver/certmagic (go-gitea#16789) (go-gitea#16790)

Signed-off-by: Andrew Thornton <art27@cantab.net>
techknowlogick pushed a commit that referenced this pull request Sep 2, 2021
## [1.15.1](https://github.com/go-gitea/gitea/releases/tag/v1.15.1) - 2021-09-02

* BUGFIXES
  * Allow BASIC authentication access to /:owner/:repo/releases/download/* (#16916) (#16923)
  * Prevent leave changes dialogs due to autofill fields (#16912) (#16920)
  * Ignore review comment when ref commit is missed (#16905) (#16919)
  * Fix wrong attachment removal (#16915) (#16917)
  * Gitlab Migrator: dont ignore reactions of last request (#16903) (#16913)
  * Correctly return the number of Repositories for Organizations (#16807) (#16911)
  * Test if LFS object is accessible (#16865) (#16904)
  * Fix git.Blob.DataAsync(): close pipe since we return a NopCloser (#16899) (#16900)
  * Fix dump and restore respository (#16698) (#16898)
  * Repare and Improve GetDiffRangeWithWhitespaceBehavior (#16894) (#16895)
  * Fix wiki raw commit diff/patch view (#16891) (#16892)
  * Ensure wiki repos are all closed (#16886) (#16888)
  * List limited and private orgs if authenticated on API (#16866) (#16879)
  * Simplify split diff view generation and remove JS dependency (#16775) (#16863)
  * Ensure that the default visibility is set on the user create page (#16845) (#16862)
  * In Render tolerate not being passed a context (#16842) (#16858)
  * Upgrade xorm to v1.2.2 (#16663) & Add test to ensure that dumping of login sources remains correct (#16847) (#16848)
  * Report the correct number of pushes on the feeds (#16811) (#16822)
  * Add primary_key to issue_index (#16813) (#16820)
  * Prevent NPE on empty commit (#16812) (#16819)
  * Fix branch pagination error (#16805) (#16816)
  * Add missing return to handleSettingRemoteAddrError (#16794) (#16795)
  * Remove spurious / from issues.opened_by (#16793)
  * Ensure that template compilation panics are sent to the logs (#16788) (#16792)
  * Update caddyserver/certmagic (#16789) (#16790)

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath zeripath added the topic/ui Change the appearance of the Gitea UI label Sep 7, 2021
zeripath added a commit that referenced this pull request Oct 15, 2021
This PR adds two buttons to the stats and the end of the diffs list to load the (some of) the remaining incomplete diff sections.

Contains #16775
    
Signed-off-by: Andrew Thornton <art27@cantab.net>


## Screenshots

### Show more button at the end of the diff
![Screenshot from 2021-09-04 11-12-37](https://user-images.githubusercontent.com/1824502/132091009-b1f6113e-2c04-4be5-8a04-b8ecea56887b.png)

### Show more button at the end of the diff stats box
![Screenshot from 2021-09-04 11-14-54](https://user-images.githubusercontent.com/1824502/132091063-86da5a6d-6628-4b82-bea9-3655cd9f40f6.png)
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. performance/speed performance issues with slow downs topic/ui Change the appearance of the Gitea UI type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve performance of showing diffs in the browser
5 participants