Skip to content

Commit d012c33

Browse files
authored
call ulab.numerical.std directly in timeit
New times ``` Computing the RMS value of 100 numbers traditional : 5.188ms [result=3535.843611] ulab, with ndarray, some implementation in python : 0.504ms [result=3535.853624] ulab only, with list : 0.636ms [result=3535.854340] ulab only, with ndarray : 0.121ms [result=3535.854340] ```
1 parent 734497f commit d012c33

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

ulab_Crunch_Numbers_Fast/benchmark.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ def normalized_rms_ulab(values):
2121
values = values - minbuf
2222
samples_sum = ulab.numerical.sum(values * values)
2323
return math.sqrt(samples_sum / len(values))
24-
25-
def normalized_std_ulab(values):
26-
return ulab.numerical.std(values)
2724

2825
# Instead of using sensor data, we generate some data
2926
# The amplitude is 5000 so the rms should be around 5000/1.414 = 3536
@@ -41,5 +38,5 @@ def timeit(s, f, n=100):
4138
print("Computing the RMS value of 100 numbers")
4239
timeit("traditional", lambda: normalized_rms(nums_list))
4340
timeit("ulab, with ndarray, some implementation in python", lambda: normalized_rms_ulab(nums_array))
44-
timeit("ulab only, with list", lambda: normalized_std_ulab(nums_list))
45-
timeit("ulab only, with ndarray", lambda: normalized_std_ulab(nums_array))
41+
timeit("ulab only, with list", lambda: ulab.numerical.std(nums_list))
42+
timeit("ulab only, with ndarray", lambda: ulab.numerical.std(nums_array))

0 commit comments

Comments
 (0)