Skip to content

Instantly share code, notes, and snippets.

@djaney
Last active August 29, 2015 14:11
Show Gist options
  • Select an option

  • Save djaney/1cd2e1710e2d5f11ee1e to your computer and use it in GitHub Desktop.

Select an option

Save djaney/1cd2e1710e2d5f11ee1e to your computer and use it in GitHub Desktop.
CPU simple benchmark
#!/usr/local/bin/python3.4
import math
import time
def worker():
x = 0
t = time.time();
sec = 0
count = 0
while sec<5:
math.sqrt(x**2 + (x*math.pi)**2)
x += 1
sec = time.time() - t
count +=1
return int(count/100000)
if __name__ == '__main__':
print('Calculating...')
print('Score: '+ str(worker()) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment