mirror of
https://github.com/junegunn/fzf.git
synced 2026-02-28 04:22:34 +08:00
Increase chunkSize from 100 to 1000 to reduce lock contention
With chunkSize=100 and 10M items, 100K chunks cause ~300K mutex lock/unlock operations per search across 32 goroutines competing for a single sync.Mutex in ChunkCache. Increasing to 1000 reduces chunks to 10K, cutting contention overhead. Benchmarks on 10M items show 14-80% faster searches depending on query selectivity.
This commit is contained in:
@@ -39,7 +39,7 @@ const (
|
|||||||
progressMinDuration = 200 * time.Millisecond
|
progressMinDuration = 200 * time.Millisecond
|
||||||
|
|
||||||
// Capacity of each chunk
|
// Capacity of each chunk
|
||||||
chunkSize int = 100
|
chunkSize int = 1000
|
||||||
|
|
||||||
// Pre-allocated memory slices to minimize GC
|
// Pre-allocated memory slices to minimize GC
|
||||||
slab16Size int = 100 * 1024 // 200KB * 32 = 12.8MB
|
slab16Size int = 100 * 1024 // 200KB * 32 = 12.8MB
|
||||||
|
|||||||
Reference in New Issue
Block a user