Raise default limit to numCPU * 16, max 128

This commit is contained in:
DataHoarder 2021-12-07 14:54:32 +01:00
parent b951d638c0
commit 9b0e636aaa

View file

@ -9,7 +9,6 @@ import (
"github.com/minio/sha256-simd"
"hash"
"io"
"math"
"os"
"runtime"
"strings"
@ -53,7 +52,13 @@ func PrintHashFileResult(result *HashFileResult) {
}
func main() {
taskLimit := flag.Int("tasklimit", int(math.Ceil(float64(runtime.NumCPU())*1.5)), "Maximum number of concurrent hashing tasks. Change to avoid fdlimit issues. Defaults to number of CPU cores * 1.5")
taskLimit := flag.Int("tasklimit", func() int {
result := runtime.NumCPU() * 16
if result > 128 {
return 128
}
return result
}(), "Maximum number of concurrent hashing tasks. Change to avoid fdlimit issues. Defaults to number of min(128, CPU cores * 16)")
flag.Parse()