-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Closed
Labels
Description
Attempting to run simple_benchmarks.py crashed (hung) MP on my Teensy 4.1 .
I reduced the program maximally to:
import time
def timeit(func, arg):
t1 = time.ticks_us()
func(arg)
t2 = time.ticks_us()
return time.ticks_diff(t2, t1) / 1e6
def bm_001AdditionA(n):
for idx in range(n):
if idx % 50 == 0:
a = 1.0
b = 1.1
c = 3.456789e-4
d = 5.678901e4
f = 1.5
a += 1.01
b = a + b
c = c + a + a + a
d = a + b + 0.9999
e = a + b + c + d
return (a, b, c, d, e)
print('Start..', end='')
for _ in range(5):
timeit(bm_001AdditionA, 50000)
time.sleep(0.1) # including this leads to a hang
# print('.', end="") # but including this runs through
print('Finish')
and still it hangs.
Strangely including the print('.', end="")
leads to ordinary run through.
Commenting that statement out still runs through, but as soon as time.sleep(0.1)
is uncommented it hangs again.
A combination of timing and printing leading to a crash..
For reproducing I installed the latest MP:
MicroPython v1.19.1-782-g699477d12 on 2022-12-20; Teensy 4.1 with MIMXRT1062DVJ6A.