1
0
mirror of https://github.com/fumiama/orbyte.git synced 2026-06-05 02:00:30 +08:00
2025-10-02 14:59:53 +08:00
2025-02-25 13:46:51 +09:00
2025-10-02 14:59:53 +08:00
2025-02-24 16:16:43 +09:00
2025-05-12 23:59:04 +09:00
2025-04-14 23:12:19 +09:00
2025-04-14 23:12:19 +09:00
2025-05-13 00:52:42 +09:00
2025-02-24 16:16:43 +09:00
2025-02-26 16:35:01 +09:00
2025-05-13 00:52:42 +09:00
2025-02-24 23:52:18 +09:00
2025-02-26 16:35:01 +09:00
2025-05-12 23:59:04 +09:00

orbyte

Lightweight & Safe (buffer-writer | general object) pool.

Quick Start

package main

import (
	"crypto/rand"
	"io"

	"github.com/fumiama/orbyte/pbuf"
)

func main() {
	buf := pbuf.NewBuffer(nil) // Allocate Buffer from pool.
	buf.P(func(buf *pbuf.Buffer) {
		io.CopyN(buf, rand.Reader, 4096) // Do sth.
	})
	// After that, buf will be auto-reused on GC.

	b := pbuf.NewBytes(1024) // Allocate Bytes from pool.
	b.V(func(b []byte) {
		rand.Read(b) // Do sth.
	})
	// After that, b will be auto-reused on GC.

}
Languages
Go 100%