forked from thisismyrobot/python-iracing-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
benchmark.py
47 lines (32 loc) · 1.27 KB
/
benchmark.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
""" Benchmarker.
Current results on my (mid performance) machine:
Press any key to begin telemetry access benchmark...
Setting up...
Attempting to read current all telemetry keys 10000 times each... Done!
10000 reads of all keys executed in 6.1890001297 seconds
Read rate for all 91 telementry values is: 1615.7698805 Hz
Read rate for a single telementry value is: 147035.059126 Hz
"""
import api
import time
ITER = 10000
print "Press any key to begin telemetry access benchmark...",
raw_input()
print "Setting up..."
client = api.API()
client['Speed']
keys = client._telemetry_names
print "Attempting to read current all telemetry keys {0} times each...".format(ITER),
start = time.time()
for i in range(ITER):
for k in keys:
_ = client[k]
end = time.time()
duration = end - start
all_telem_hz = 1 / (duration / ITER)
telem_hz = all_telem_hz * len(keys)
print "Done!"
print "{0} reads of all keys executed in {1} seconds".format(ITER, duration)
print "Read rate for all {0} telementry values is: {1} Hz".format(len(keys),
all_telem_hz)
print "Read rate for a single telementry value is: {0} Hz".format(telem_hz)