Skip to content

m4yukh10/go-python-compared

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

⚡ 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

About

this repository includes various algorithms implemented in both golang and python. execution time is being compared here

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors