MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / BenchmarkAllocations

Function BenchmarkAllocations

consistent/consistent_test.go:779–795  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

777}
778
779func BenchmarkAllocations(b *testing.B) {
780 kms.Unittest = true
781 utils.RemoveAll(testStorePath + "*")
782 //kms.ResetBucket()
783
784 x, _ := InitConsistent(testStorePath, new(KMSStorage), false)
785 defer utils.RemoveAll(testStorePath + "*")
786 x.Add(NewNodeFromString("stays"))
787 b.ResetTimer()
788 allocSize := allocBytes(func() {
789 for i := 0; i < b.N; i++ {
790 x.Add(NewNodeFromString("Foo"))
791 x.Remove(NodeID("Foo"))
792 }
793 })
794 b.Logf("%d: Allocated %d bytes (%.2fx)", b.N, allocSize, float64(allocSize)/float64(b.N))
795}
796
797func BenchmarkMalloc(b *testing.B) {
798 kms.Unittest = true

Callers

nothing calls this directly

Calls 7

RemoveAllFunction · 0.92
InitConsistentFunction · 0.85
NewNodeFromStringFunction · 0.85
allocBytesFunction · 0.85
NodeIDTypeAlias · 0.85
AddMethod · 0.45
RemoveMethod · 0.45

Tested by

no test coverage detected