syncPool-example

module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2020 License: MIT

README

syncPool-example

Example usage of sync.Pool.

Benchmark Results

Run make bench to see the results yourself.

You'll need benchstat to see the comparison: go get -u golang.org/x/perf/cmd/benchstat

name               old time/op    new time/op    delta
UnmarshalObject-8    1.33µs ± 8%    1.25µs ± 2%   -6.27%  (p=0.001 n=10+8)

name               old alloc/op   new alloc/op   delta
UnmarshalObject-8      352B ± 0%      248B ± 0%  -29.55%  (p=0.000 n=10+10)

name               old allocs/op  new allocs/op  delta
UnmarshalObject-8      8.00 ± 0%      5.00 ± 0%  -37.50%  (p=0.000 n=10+10)

Directories

Path Synopsis
pkg
base
Package base provides common items used by other packages to standardize the tests and benchmarks.
Package base provides common items used by other packages to standardize the tests and benchmarks.
original
Package original provides an example usage of unmarshalling JSON into a struct without using sync.Pool and allocating a new struct every time.
Package original provides an example usage of unmarshalling JSON into a struct without using sync.Pool and allocating a new struct every time.
pool
Package pool provides an example usage of unmarshalling JSON into a struct using sync.Pool.
Package pool provides an example usage of unmarshalling JSON into a struct using sync.Pool.

Jump to

Keyboard shortcuts

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