MCPcopy
hub / github.com/teivah/100-go-mistakes / add

Function add

src/12-optimizations/93-instruction-level-parallelism/main.go:5–13  ·  view source on GitHub ↗
(s [2]int64)

Source from the content-addressed store, hash-verified

3const n = 1_000_000
4
5func add(s [2]int64) [2]int64 {
6 for i := 0; i < n; i++ {
7 s[0]++
8 if s[0]%2 == 0 {
9 s[1]++
10 }
11 }
12 return s
13}
14
15func add2(s [2]int64) [2]int64 {
16 for i := 0; i < n; i++ {

Callers 1

BenchmarkAddFunction · 0.85

Calls

no outgoing calls

Tested by 1

BenchmarkAddFunction · 0.68