Code
Hub
Workspaces
Connect
Indexed graphs
Engine
MCP
copy
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
3
const
n = 1_000_000
4
5
func
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
15
func
add2(s [2]int64) [2]int64 {
16
for
i := 0; i < n; i++ {
Callers
1
BenchmarkAdd
Function · 0.85
Calls
no outgoing calls
Tested by
1
BenchmarkAdd
Function · 0.68