⭐ the project to show your appreciation.
This package is a thin wrapper over the Pool
provided by the sync
package. The Pool
is an essential package to obtain maximum performance by reducing the number of memory allocations.
- Invalidate an item from the Pool (so it never gets used again)
- Set a maximum number of items for the Pool
- Returns the number of items in the pool (idle and in-use)
If you frequently allocate many objects of the same type and you want to save some memory allocation and garbage allocation overhead — @jrv
How did I improve latency by 700% using sync.Pool
import "github.com/rocketlaunchr/go-pool"
pool := pool.New(5) // maximum of 5 items in pool
pool.SetFactory(func() interface{} {
return &X{}
})
item := pool.Borrow()
defer item.Return()
// Use item here or mark as invalid
x := item.Item.(*X) // Use item here
item.MarkAsInvalid()
- awesome-svelte - Resources for killing react
- dataframe-go - Statistics and data manipulation
- dbq - Zero boilerplate database operations for Go
- electron-alert - SweetAlert2 for Electron Applications
- google-search - Scrape google search results
- igo - A Go transpiler with cool new syntax such as fordefer (defer for for-loops)
- mysql-go - Properly cancel slow MySQL queries
- react - Build front end applications using Go
- remember-go - Cache slow database queries
- testing-go - Testing framework for unit testing
- Renee French (gopher)
- Samuel Jirénius (illustration)