Skip to content

Instantly share code, notes, and snippets.

@rodrigograca31
Created April 10, 2020 10:12
Show Gist options
  • Save rodrigograca31/984d23f73f04ea21d05b12190d3e6d2a to your computer and use it in GitHub Desktop.
Save rodrigograca31/984d23f73f04ea21d05b12190d3e6d2a to your computer and use it in GitHub Desktop.
Test Python performance 🐍⚑
import time
times = 5000000
def func1():
return 5 + 5
def func2():
return 5 + 5 - 5 + 5
print(func1())
print(func2())
start = time.time()
for x in range(times):
(func1())
print("Imp 1: \t%.8f" % float(time.time() - start))
start = time.time()
for x in range(times):
(func2())
print("Imp 2: \t%.8f" % float(time.time() - start))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment