Skip to content

Latest commit

 

History

History
45 lines (30 loc) · 788 Bytes

File metadata and controls

45 lines (30 loc) · 788 Bytes

⚡ Go vs Python Speed Test

A quick comparison of execution speed between Go and Python using simple benchmark logic.


🧩 Test 1: Sum from 0 to 100000

Both programs calculate the sum of all integers from 0 to 100000.

Go (main.go)

start := time.Now()
sum := 0
for x := 0; x <= 100000; x++ {
	sum += x
}
fmt.Printf("Time: %v\n", time.Since(start))

Python (main.py)

start = time.perf_counter()
total = sum(range(100001))
print(f"Time: {time.perf_counter() - start:.6f}s")

🧮 Results

Language Time Taken
Go 0.000508 s
Python 0.010699 s

⚙️ Go ran ~21× faster than Python for this simple loop.


Author: Mayukh Sen