Last active
August 29, 2015 14:11
-
-
Save djaney/1cd2e1710e2d5f11ee1e to your computer and use it in GitHub Desktop.
CPU simple benchmark
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
| #!/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