bufpool

package
v0.48.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2026 License: Unlicense Imports: 2 Imported by: 0

Documentation

Overview

Package bufpool provides buffer pools for reducing GC pressure in hot paths. This is the WASM version which uses simple allocations since sync.Pool behavior differs in WASM environments.

Index

Constants

View Source
const (
	// SmallBufferSize for index keys (8-64 bytes typical)
	SmallBufferSize = 64

	// MediumBufferSize for event encoding (300-1000 bytes typical)
	MediumBufferSize = 1024
)

Variables

This section is empty.

Functions

func CopyBytes

func CopyBytes(buf *bytes.Buffer) []byte

CopyBytes copies the buffer contents to a new slice.

func GetMedium

func GetMedium() *bytes.Buffer

GetMedium returns a medium buffer (1KB).

func GetSmall

func GetSmall() *bytes.Buffer

GetSmall returns a small buffer (64 bytes). In WASM, we simply allocate new buffers as sync.Pool is less effective.

func PutMedium

func PutMedium(buf *bytes.Buffer)

PutMedium is a no-op in WASM; the buffer will be garbage collected.

func PutSmall

func PutSmall(buf *bytes.Buffer)

PutSmall is a no-op in WASM; the buffer will be garbage collected.

Types

This section is empty.

Source Files

  • pool_wasm.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL