-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Add more bench #3161
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 more bench #3161
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3161 +/- ##
======================================
Coverage 34.9% 34.9%
======================================
Files 277 277
Lines 40108 40108
======================================
Hits 14000 14000
Misses 24059 24059
Partials 2049 2049
Continue to review full report at Codecov.
|
LGTM |
integrations/benchmarks_test.go
Outdated
for i := 0; i < b.N; i++ { | ||
b.StopTimer() | ||
branchName := StringWithCharset(5+rand.Intn(10), "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/") | ||
fmt.Println(branchName) |
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.
Should these prints be removed (also line 113)?
integrations/benchmarks_test.go
Outdated
for i, s := range samples { | ||
samples[i].repo = models.AssertExistsAndLoadBean(b, &models.Repository{ID: s.repoID}).(*models.Repository) | ||
samples[i].owner = models.AssertExistsAndLoadBean(b, &models.User{ID: samples[i].repo.OwnerID}).(*models.User) | ||
} |
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.
I think this can be simplified. Just make samples
a list of repo IDs, and load the owner and repo in the main loop. We can get rid of the anonymous struct and this first loop.
for _, repoID := range repoIDs {
repo := models.AssertExistsAndLoadBean(b, &models.Repository{ID: repoID}).(*models.Repository)
owner := models.AssertExistsAndLoadBean(b, &models.User{ID: repo.OwnerID}).(*models.User)
... // run test
}
integrations/benchmarks_test.go
Outdated
b.Run("Create", func(b *testing.B) { | ||
for i := 0; i < b.N; i++ { | ||
b.StopTimer() | ||
branchName := StringWithCharset(5+rand.Intn(10), "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/") |
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.
branchName
could begin with a slash, in which case it would not be a valid branch name
integrations/benchmarks_test.go
Outdated
} | ||
}) | ||
branchCount := len(branches) | ||
b.Run("WebBranchCommit", func(b *testing.B) { |
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.
Would "WebViewCommit"
be a better name? The :owner/:repo/commit/:sha
endpoint doesn't necessarily have anything to do with branches.
LGTM |
Add some bench for testing so I propose to add them.