https://github.com/vtopc/go-airmat
Pool Float Air Mattress that could be used for sync.Pool
https://github.com/vtopc/go-airmat
concurrency go golang pool sync
Last synced: 2 months ago
JSON representation
Pool Float Air Mattress that could be used for sync.Pool
- Host: GitHub
- URL: https://github.com/vtopc/go-airmat
- Owner: vtopc
- License: mit
- Created: 2022-09-27T16:40:54.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-03-26T09:33:54.000Z (about 2 years ago)
- Last Synced: 2024-12-25T12:15:36.655Z (4 months ago)
- Topics: concurrency, go, golang, pool, sync
- Language: Go
- Homepage:
- Size: 40 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-airmat

Float Air Mattress is a container for a slice that could be used with [sync.Pool](https://pkg.go.dev/sync#Pool).
Has a minimum allocations.## Benchmarks
```shell
go test -bench=. -cpu=4 -benchmem
goos: darwin
goarch: amd64
pkg: github.com/vtopc/go-airmat
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
BenchmarkMakeSlices/8-4 1677363 731.3 ns/op 4080 B/op 8 allocs/op
BenchmarkMakeSlices/16-4 10000 105324 ns/op 1048563 B/op 16 allocs/op
BenchmarkMakeSlices/24-4 100 15483531 ns/op 268435443 B/op 24 allocs/op
BenchmarkPool/8-4 4156912 288.8 ns/op 0 B/op 0 allocs/op
BenchmarkPool/16-4 56299 19531 ns/op 9 B/op 0 allocs/op
BenchmarkPool/24-4 133 8669618 ns/op 13 B/op 0 allocs/op
```## TODO
1. Shrink huge Mattresses, e.g.:
- https://github.com/golang/go/issues/27735#issuecomment-739169121
- https://github.com/valyala/bytebufferpool