MCPcopy Index your code
hub / github.com/go-git/go-git / BenchmarkObjects

Function BenchmarkObjects

repository_test.go:3381–3424  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

3379}
3380
3381func BenchmarkObjects(b *testing.B) {
3382 defer fixtures.Clean()
3383
3384 for _, f := range fixtures.ByTag("packfile") {
3385 if f.DotGitHash == "" {
3386 continue
3387 }
3388
3389 b.Run(f.URL, func(b *testing.B) {
3390 fs := f.DotGit()
3391 st := filesystem.NewStorage(fs, cache.NewObjectLRUDefault())
3392
3393 worktree, err := fs.Chroot(filepath.Dir(fs.Root()))
3394 if err != nil {
3395 b.Fatal(err)
3396 }
3397
3398 repo, err := Open(st, worktree)
3399 if err != nil {
3400 b.Fatal(err)
3401 }
3402
3403 for i := 0; i < b.N; i++ {
3404 iter, err := repo.Objects()
3405 if err != nil {
3406 b.Fatal(err)
3407 }
3408
3409 for {
3410 _, err := iter.Next()
3411 if err == io.EOF {
3412 break
3413 }
3414
3415 if err != nil {
3416 b.Fatal(err)
3417 }
3418 }
3419
3420 iter.Close()
3421 }
3422 })
3423 }
3424}
3425
3426func BenchmarkPlainClone(b *testing.B) {
3427 b.StopTimer()

Callers

nothing calls this directly

Calls 9

NewStorageFunction · 0.92
NewObjectLRUDefaultFunction · 0.92
OpenFunction · 0.85
CleanMethod · 0.80
RootMethod · 0.80
NextMethod · 0.65
CloseMethod · 0.65
ChrootMethod · 0.45
ObjectsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…