MCPcopy
hub / github.com/go-git/go-git / BenchmarkGetObjectFromPackfile

Function BenchmarkGetObjectFromPackfile

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

Source from the content-addressed store, hash-verified

557}
558
559func BenchmarkGetObjectFromPackfile(b *testing.B) {
560 defer fixtures.Clean()
561
562 for _, f := range fixtures.Basic() {
563 b.Run(f.URL, func(b *testing.B) {
564 fs := f.DotGit()
565 o := NewObjectStorage(dotgit.New(fs), cache.NewObjectLRUDefault())
566 for i := 0; i < b.N; i++ {
567 expected := plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5")
568 obj, err := o.EncodedObject(plumbing.AnyObject, expected)
569 if err != nil {
570 b.Fatal(err)
571 }
572
573 if obj.Hash() != expected {
574 b.Errorf("expecting %s, got %s", expected, obj.Hash())
575 }
576 }
577 })
578 }
579}
580
581func (s *FsSuite) TestGetFromUnpackedCachesObjects(c *C) {
582 fs := fixtures.ByTag(".git").ByTag("unpacked").One().DotGit()

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…