MCPcopy Create free account
hub / github.com/go-git/go-git / BenchmarkGetObjectFromPackfile

Function BenchmarkGetObjectFromPackfile

storage/filesystem/object_test.go:529–549  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

527}
528
529func BenchmarkGetObjectFromPackfile(b *testing.B) {
530 defer fixtures.Clean()
531
532 for _, f := range fixtures.Basic() {
533 b.Run(f.URL, func(b *testing.B) {
534 fs := f.DotGit()
535 o := NewObjectStorage(dotgit.New(fs), cache.NewObjectLRUDefault())
536 for i := 0; i < b.N; i++ {
537 expected := plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5")
538 obj, err := o.EncodedObject(plumbing.AnyObject, expected)
539 if err != nil {
540 b.Fatal(err)
541 }
542
543 if obj.Hash() != expected {
544 b.Errorf("expecting %s, got %s", expected, obj.Hash())
545 }
546 }
547 })
548 }
549}

Callers

nothing calls this directly

Calls 7

EncodedObjectMethod · 0.95
NewFunction · 0.92
NewObjectLRUDefaultFunction · 0.92
NewHashFunction · 0.92
CleanMethod · 0.80
NewObjectStorageFunction · 0.70
HashMethod · 0.65

Tested by

no test coverage detected