Last active
June 13, 2020 18:21
-
-
Save paulwinex/739b4f43ffe8d1c6fabad982333ff6a7 to your computer and use it in GitHub Desktop.
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
import time | |
import os | |
def compute(): | |
array = [] | |
for i in range(10): | |
start = time.perf_counter() | |
for i in range(1000000): | |
x = 2*2 | |
array.append(time.perf_counter() - start) | |
return sum(array) / len(array) | |
# start test 1 | |
t1 = compute() | |
# change niceness | |
os.nice(19) | |
# Start test 2 | |
t2 = compute() | |
# result | |
print("Test 1", t1, "sec") | |
print("Test 2", t2, "sec") | |
print("Diff", t2/t1, "times") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment