Discover Packages
github.com/chenquan/go-pkg
xbytes
package
Version:
v0.2.0
Opens a new window with list of versions in this module.
Published: Jan 31, 2022
License: Apache-2.0
Opens a new window with license information.
Imports: 4
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
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
Expand ▾
Collapse ▴
Documentation
¶
Free recovers a bytes of slice.
func Malloc(size, capacity int ) []byte
Malloc returns a bytes of slice.
MallocSize returns a bytes of slice.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.