MCPcopy Create free account
hub / github.com/beeker1121/goque / BenchmarkStackPop

Function BenchmarkStackPop

stack_test.go:608–631  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

606}
607
608func BenchmarkStackPop(b *testing.B) {
609 // Open test database
610 file := fmt.Sprintf("test_db_%d", time.Now().UnixNano())
611 s, err := OpenStack(file)
612 if err != nil {
613 b.Error(err)
614 }
615 defer s.Drop()
616
617 // Fill with dummy data
618 for n := 0; n < b.N; n++ {
619 if _, err = s.PushString("value"); err != nil {
620 b.Error(err)
621 }
622 }
623
624 // Start benchmark
625 b.ResetTimer()
626 b.ReportAllocs()
627
628 for n := 0; n < b.N; n++ {
629 _, _ = s.Pop()
630 }
631}

Callers

nothing calls this directly

Calls 4

OpenStackFunction · 0.85
PushStringMethod · 0.80
PopMethod · 0.80
DropMethod · 0.45

Tested by

no test coverage detected