Walton
Walton

Reputation: 187

Go Benchmark Output Format

My function name is BenchmarkArray1 what does the -12 represent?

BenchmarkArray1-12              1000000000               0.826 ns/op

Upvotes: 2

Views: 516

Answers (1)

Ashwin Shirva
Ashwin Shirva

Reputation: 1441

It is supposed to be interpreted as 12 not -12.

It is the value of GOMAXPROCS environment variable. GOMAXPROCS is a parameter used by the go scheduler to determine how many OS threads may be actively executing Go code simultaneously.

Its default value is the no. of CPUs in your machine.

GOMAXPROCS is actually the value of n in, go's m:n scheduling(m go routines running on n operating system threads)

Upvotes: 5

Related Questions