https://github.com/peterbourgon/rb
High-performance in-memory ring buffer
https://github.com/peterbourgon/rb
golang high-performance metallica ring-buffer ringbuffer
Last synced: 4 months ago
JSON representation
High-performance in-memory ring buffer
- Host: GitHub
- URL: https://github.com/peterbourgon/rb
- Owner: peterbourgon
- License: apache-2.0
- Created: 2025-04-13T12:58:13.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-06-11T18:23:56.000Z (8 months ago)
- Last Synced: 2025-06-11T20:07:59.720Z (8 months ago)
- Topics: golang, high-performance, metallica, ring-buffer, ringbuffer
- Language: Go
- Homepage:
- Size: 19.5 KB
- Stars: 22
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rb [](https://pkg.go.dev/github.com/peterbourgon/rb) [](https://github.com/peterbourgon/rb/releases) [](https://github.com/peterbourgon/rb/actions/workflows/test.yaml)
In-memory ring buffer optimized for high-throughput write-heavy workloads.
Buffers are fully allocated during construction, so adds are zero-alloc and reasonably fast.
```
goos: darwin
goarch: arm64
pkg: github.com/peterbourgon/rb
cpu: Apple M3 Pro
BenchmarkRingBuffer/cap=100/Add-11 267911362 4.408 ns/op 0 B/op 0 allocs/op
BenchmarkRingBuffer/cap=1000/Add-11 270116073 4.446 ns/op 0 B/op 0 allocs/op
BenchmarkRingBuffer/cap=10000/Add-11 267690060 4.456 ns/op 0 B/op 0 allocs/op
BenchmarkRingBuffer/cap=100000/Add-11 269908416 4.450 ns/op 0 B/op 0 allocs/op
BenchmarkRingBuffer/cap=1000000/Add-11 266172448 4.563 ns/op 0 B/op 0 allocs/op
```
It's pretty self-explanatory. [See the documentation](https://pkg.go.dev/github.com/peterbourgon/rb) for details.