xbytes

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

README

Xbytes

Install

go get -u github.com/chenquan/go-pkg/xbytes

Use

package main

import (
	"github.com/chenquan/go-pkg/xbytes"
)

func main() {
	pool := xbytes.GetNBytesPool(10)
	// Get
	b := pool.Get()
	_ = b
	// Recover 
	pool.Put(b)
}

Benchmark

goos: windows
goarch: amd64
pkg: github.com/chenquan/go-pxg/xbytes
cpu: Intel(R) Core(TM) i5-8265UC CPU @ 1.60GHz
BenchmarkMakeBytes-8                2281            591449 ns/op         2264156 B/op         28 allocs/op
BenchmarkGetNBytesPool-8           10000            127145 ns/op            4811 B/op        149 allocs/op

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Free added in v0.1.1

func Free(buf []byte)

Free recovers a bytes of slice.

func Malloc added in v0.1.1

func Malloc(size, capacity int) []byte

Malloc returns a bytes of slice.

func MallocSize added in v0.1.1

func MallocSize(size int) []byte

MallocSize returns a bytes of slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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