mirror of
https://github.com/junegunn/fzf.git
synced 2026-03-02 13:27:16 +08:00
Add --threads option to control matcher concurrency
By default, fzf uses 8 * NumCPU goroutines (capped at 32) for parallel matching. --threads N overrides this to use exactly N goroutines, which is useful for benchmarking and profiling.
This commit is contained in:
@@ -678,6 +678,7 @@ type Options struct {
|
||||
WalkerSkip []string
|
||||
Version bool
|
||||
Help bool
|
||||
Threads int
|
||||
Bench time.Duration
|
||||
CPUProfile string
|
||||
MEMProfile string
|
||||
@@ -3375,6 +3376,13 @@ func parseOptions(index *int, opts *Options, allArgs []string) error {
|
||||
return err
|
||||
}
|
||||
opts.WalkerSkip = filterNonEmpty(strings.Split(str, ","))
|
||||
case "--threads":
|
||||
if opts.Threads, err = nextInt("number of threads required"); err != nil {
|
||||
return err
|
||||
}
|
||||
if opts.Threads < 0 {
|
||||
return errors.New("--threads must be a positive integer")
|
||||
}
|
||||
case "--bench":
|
||||
str, err := nextString("duration required (e.g. 3s, 500ms)")
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user