~poldi1405/go-yenc

ref: db8820d1a641a361e795ea23f26415f1c5eec62d go-yenc/limit.go -rw-r--r-- 274 bytes
db8820d1 — Moritz Poldrack started work on encoder 1 year, 1 month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package yenc

import "runtime"

func GetLimit() int {
	goroutines := runtime.NumCPU()
	goroutines *= 4 // every CPU-Thread gets 4 Jobs on average

	if runtime.NumCPU() > 8 {
		goroutines *= 4 // since we have more than 4 threads assume a modern CPU
	}

	return goroutines
}