Created
May 19, 2025 06:28
-
-
Save antonkalik/4a2c8d1d7ec1b176eab5ead4900ca567 to your computer and use it in GitHub Desktop.
Loop Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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