-
-
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
Speed up HasUserStopwatch & GetActiveStopwatch #23051
Speed up HasUserStopwatch & GetActiveStopwatch #23051
Conversation
GetActiveStopwatch & HasUserStopwatch is a hot piece of code that is repeatedly called and on examination of the cpu profile for TestGit it represents 0.44 seconds of CPU time. This PR reduces this time to 80ms. Signed-off-by: Andrew Thornton <art27@cantab.net>
This comment was marked as off-topic.
This comment was marked as off-topic.
Just compared CI spent time with other PRs. One time is 27 minutes, another time is 35 minutes. |
I think those are different/independent problems. For this PR, it could improve the all Gitea servers performance during daily usage. For CI speed, it's not related to this PR.
|
Maybe I'm wrong to mention CI because you mentioned |
There should be a small CI improvement but most of my current PRs are going to be improvements in clock-time of the range of less than a minute. Our variance in CI is more than that. My opening comment mentions CPU time - this is slightly different from clock-time - it's possible that there is no clock-time improvement as the bulk of time is IO time - however, reducing CPU time is still useful. If go is measuring something as CPU time on the cpuprofile then that may be cpu time the goroutine runner could be using elsewhere. |
You've just mentioned the problems with coming up with a well-measured benchmark - there's too many interrelated factors and noise here that I don't think it's fundamentally possible. That's why I'm mostly stabbing in the dark here looking at things that are common based on clocktime and cputime. HasUserStopwatch repeatedly stood out on the cpuprofile for TestGit and given that's really hot code I think it's a good case for optimisation in any case. Interpretting the FGProf clock time profile for TestGit is difficult but it appears heavily IO bound (unsurprising) so I'm just not certain what else we can do for that apart from just drop the big commit and/or not include the big commit in the merges etc. |
@lunny I just want to note that there is a slight change in this code - the use of INNER JOIN for My opinion is that this is fine for HasUserStopwatch but it is a change. |
Signed-off-by: Andrew Thornton <art27@cantab.net>
… into speed-up-get-active-stopwatch
I think that's not the scope of this PR. |
CI failure is related. |
Sorry, mistake when dealing with comments - the change induced overriding of the provided issue - have changed to use the name |
* giteaofficial/main: [skip ci] Updated translations via Crowdin Change button text for commenting and closing an issue at the same time (go-gitea#23135) Don't run unnecessary steps when only docs changed (go-gitea#23103) Add word-break to sidebar-item-link (go-gitea#23146) Speed up HasUserStopwatch & GetActiveStopwatch (go-gitea#23051) Add InsecureSkipVerify to Minio Client for Storage (go-gitea#23166) Fix Fomantic UI's `touchstart` fastclick, always use `click` for click events (go-gitea#23065) Remove useless comment in go-gitea#23114 (go-gitea#23173) Remove xin-u from maintainers (go-gitea#23170)
GetActiveStopwatch & HasUserStopwatch is a hot piece of code that is repeatedly called and on examination of the cpu profile for TestGit it represents 0.44 seconds of CPU time. This PR reduces this time to 80ms.