Skip to content

Instantly share code, notes, and snippets.

@antonkalik
Created May 19, 2025 06:28
Show Gist options
  • Save antonkalik/4a2c8d1d7ec1b176eab5ead4900ca567 to your computer and use it in GitHub Desktop.
Save antonkalik/4a2c8d1d7ec1b176eab5ead4900ca567 to your computer and use it in GitHub Desktop.
Loop Test
package main
import (
"fmt"
"time"
)
func main() {
start := time.Now()
var sum int64 = 0
for i := int64(0); i < 1_000_000_000; i++ {
sum += i
}
duration := time.Since(start)
fmt.Println("Go Loop Benchmark:", duration)
fmt.Println("Sum:", sum)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment