-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.go
More file actions
29 lines (26 loc) · 980 Bytes
/
config.go
File metadata and controls
29 lines (26 loc) · 980 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package cmap
type Config struct {
// P is a performance parameter, a value from 0.0 to 1.0 that tunes the trade-off
// between CPU efficiency (fewer pointers for the GOGC to scan) and memory
// efficiency (less wasted space in chunks).
//
// - A value of 1.0 prioritizes minimizing the number of chunks (larger chunks) to
// reduce GC pressure, at the cost of higher potential memory waste.
//
// - A value of 0.0 prioritizes minimizing memory waste by using smaller chunks,
// at the cost of higher potential GC pressure.
//
// - A value of 0.5 aims to balance memory waste against GC pressure by favouring
// small chunks for small buffers and larger chunks for large buffers.
P float64
CompactDeadRatio float64 // Ratio of dead to live space for when to trigger compaction.
}
func DefaultChunkPoolConfig() ChunkPoolConfig {
return ChunkPoolConfig{
FreeThresholds: [len(chunkSizes)]int{
1024, // 64MB
128, // 64MB
64, // 128MB
},
}
}