https://github.com/probably-not/static-sync-pool
A wrapper around the Go Standard Library sync.Pool primitive, which ensures ensures that we keep a static amount of values in memory (unaffected by GC), while allowing us the full benefits of the sync.Pool.
https://github.com/probably-not/static-sync-pool
Last synced: 2 months ago
JSON representation
A wrapper around the Go Standard Library sync.Pool primitive, which ensures ensures that we keep a static amount of values in memory (unaffected by GC), while allowing us the full benefits of the sync.Pool.
- Host: GitHub
- URL: https://github.com/probably-not/static-sync-pool
- Owner: probably-not
- License: mit
- Created: 2023-11-19T10:52:42.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-22T07:35:39.000Z (over 2 years ago)
- Last Synced: 2025-01-07T06:32:13.604Z (over 1 year ago)
- Language: Go
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# static-sync-pool
A wrapper around the Go Standard Library sync.Pool primitive, which ensures ensures that we keep a static amount of values in memory (unaffected by GC), while allowing us the full benefits of the sync.Pool.
## Why
The Go author's are a lot smarter than me, so I don't think I could make a more performant sync.Pool (unlike other people). However, I do believe there are situations where you don't want your pool affected by GC. Somebody nerd-sniped me about this, so I built a little implementation here. We get the full capability of sync.Pool:
- Concurrency Safety
- Garbage Collection of the pool
- Pool item reuse
- Fast and standard
While getting the added bonus of being able to set a certain number of values as static (i.e. not GC-able).