MCPcopy
hub / github.com/kopia/kopia / runInParallel

Function runInParallel

cli/command_benchmark.go:67–82  ·  view source on GitHub ↗
(args []A, run func(arg A) T)

Source from the content-addressed store, hash-verified

65}
66
67func runInParallel[A, T any](args []A, run func(arg A) T) T {
68 var wg sync.WaitGroup
69
70 for _, arg := range args[1:] {
71 wg.Go(func() {
72 run(arg)
73 })
74 }
75
76 // run one on the main goroutine and N-1 in parallel.
77 v := run(args[0])
78
79 wg.Wait()
80
81 return v
82}
83
84func makeOutputBuffers(n, capacity int) []*bytes.Buffer {
85 var res []*bytes.Buffer

Callers 4

runInParallelNoInputFunction · 0.85
runInParallelNoResultFunction · 0.85
runCompressionMethod · 0.85
runDecompressionMethod · 0.85

Calls 1

WaitMethod · 0.65

Tested by

no test coverage detected