A simple, fast, and easy-to-use library for optimally creating and handling data.
go get github.com/daanv2/go-optimal
// SliceSize returns the size that a slice should be to fit in the target cache
sliceSize := optimal.SliceSize[T]()
cpu.GetCPUInfo()
// These functions will be done in parralel, optimally splitting the work
parallel.ForEach()
parallel.Map()
parallel.All()
The documentation can be found go dev or here.
Variable | Optional | Documentation |
---|---|---|
CPU_CACHE_L1 |
true |
Cache L1 size in bytes, When set overrides the scraped value |
CPU_CACHE_L2 |
true |
Cache L2 size in bytes, When set overrides the scraped value |
CPU_CACHE_L3 |
true |
Cache L3 size in bytes, When set overrides the scraped value |
CPU_CACHE_OPTIMAL_SIZE |
true |
Optimal cache size in bytes, When set overrides the scraped value |
CPU_CACHE_TARGET |
true |
What type of cache to target, can be L1, L2, L3, anything else and it will determine on its own |