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

Function BenchmarkPrefixQueueEnqueue

prefix_queue_test.go:541–556  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

539}
540
541func BenchmarkPrefixQueueEnqueue(b *testing.B) {
542 // Open test database
543 file := fmt.Sprintf("test_db_%d", time.Now().UnixNano())
544 pq, err := OpenPrefixQueue(file)
545 if err != nil {
546 b.Error(err)
547 }
548 defer pq.Drop()
549
550 b.ResetTimer()
551 b.ReportAllocs()
552
553 for n := 0; n < b.N; n++ {
554 _, _ = pq.Enqueue([]byte("prefix"), []byte("value"))
555 }
556}
557
558func BenchmarkPrefixQueueDequeue(b *testing.B) {
559 // Open test database

Callers

nothing calls this directly

Calls 3

OpenPrefixQueueFunction · 0.85
DropMethod · 0.45
EnqueueMethod · 0.45

Tested by

no test coverage detected