diff --git a/SynchRoGazer.go b/SynchRoGazer.go index 473d2a1..e3933f9 100644 --- a/SynchRoGazer.go +++ b/SynchRoGazer.go @@ -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()