Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for BenchmarkRingBuffer_Sync (0.18 sec)

  1. internal/ringbuffer/ring_buffer_benchmark_test.go

    package ringbuffer
    
    import (
    	"io"
    	"strings"
    	"testing"
    )
    
    func BenchmarkRingBuffer_Sync(b *testing.B) {
    	rb := New(1024)
    	data := []byte(strings.Repeat("a", 512))
    	buf := make([]byte, 512)
    
    	b.ResetTimer()
    	for i := 0; i < b.N; i++ {
    		rb.Write(data)
    		rb.Read(buf)
    	}
    }
    
    func BenchmarkRingBuffer_AsyncRead(b *testing.B) {
    	// Pretty useless benchmark, but it's here for completeness.
    	rb := New(1024)
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Wed May 15 00:11:04 UTC 2024
    - 1.7K bytes
    - Viewed (0)
Back to top