Last active
February 28, 2023 11:50
-
-
Save amaank404/a4da714108083f9d21a363b30574ab06 to your computer and use it in GitHub Desktop.
A Simple Benchmark program intended to run without any open programs. It works on any Python Implementation
This file contains 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
import time | |
def r1(t: float): | |
x = 0 | |
y = 0 | |
timer = time.perf_counter() | |
while time.perf_counter() - timer < t: | |
x += 7 | |
y += 1 | |
return y | |
def r2(t: float): | |
x = 0 | |
y = 1 | |
timer = time.perf_counter() | |
while time.perf_counter() - timer < t: | |
x -= 7 | |
y += 1 | |
return y | |
def r3(t: float): | |
x = 0 | |
y = 0 | |
timer = time.perf_counter() | |
while time.perf_counter() - timer < t: | |
x *= 7 | |
y += 1 | |
return y | |
def r4(t: float): | |
x = 0 | |
y = 0 | |
timer = time.perf_counter() | |
while time.perf_counter() - timer < t: | |
x /= 7 | |
y += 1 | |
return y | |
d = 5 | |
print("Starting Arithmetic Tests: 10s") | |
s1 = [r1(.5) for _ in range(d)] | |
s2 = [r2(.5) for _ in range(d)] | |
s3 = [r3(.5) for _ in range(d)] | |
s4 = [r4(.5) for _ in range(d)] | |
scores = s1+s2+s3+s4 | |
score = sum(scores) / len(scores) | |
print(""" | |
Results: | |
Arithmetic Tests: | |
Test #1 (Addition): """+str((sum(s1)/len(s1))//10000)+""" | |
Test #2 (Subtraction: """+str((sum(s2)/len(s2))//10000)+""" | |
Test #3 (Multiplication): """+str((sum(s3)/len(s3))//10000)+""" | |
Test #4 (Division): """+str((sum(s4)/len(s4))//10000)+""" | |
Final Score: """+str(score//10000)+""" | |
""") | |
input() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My new laptop score was 329.