V1.22 is very slow (Raspberry Pi Pico) #14437
Replies: 6 comments 7 replies
-
Could you repeat the test with the actual 1.23 preview? |
Beta Was this translation helpful? Give feedback.
-
If possible can you also share some test code that creates these results? |
Beta Was this translation helpful? Give feedback.
-
Are you sure you ran the tests at the same processor speed? Here is what I have on my Pico: MPY: soft reboot
MicroPython v1.22.2 on 2024-02-22; Raspberry Pi Pico with RP2040
Type "help()" for more information.
>>> import machine
>>> machine.freq()
125000000
>>> machine.freq(260000000)
>>> machine.freq()
260000000
>>> machine.freq(280000000)
[tio 15:46:32] Disconnected
[tio 15:46:35] Connected
Trying |
Beta Was this translation helpful? Give feedback.
-
@micropython.viper
def funct(x):
return x**2.5
from gc import collect, mem_free
from time import ticks_cpu
print(f'frequency = {machine.freq()//1e6} MHz')
collect()
mem_free()
L = []
t = ticks_cpu()
for i in range(8000):
L.append(funct(i))
print(f'1: {ticks_cpu() - t}')
del L
collect()
mem_free()
t = ticks_cpu()
L = list(map(funct, range(8000)))
print(f'2: {ticks_cpu() - t}')
del L
collect()
mem_free()
t = ticks_cpu()
L = list(map(lambda x: x**2.5, range(8000)))
print(f'3: {ticks_cpu() - t}')
del L
collect()
mem_free() |
Beta Was this translation helpful? Give feedback.
-
@ThHupk I see you closed this as resolved. Did you fix the performance slowdown? |
Beta Was this translation helpful? Give feedback.
-
Wait, what? The rp2040 ROM floating point routines (Mark Owen's Qfplib, used under licence) are about the only way to get acceptable floating point performance out of a Cortex-M0. If that had changed, everyone would be complaining about the speed |
Beta Was this translation helpful? Give feedback.
-
I have noticed that my programs are running almost three times slower than with previous versions of MicroPython.
What could be the reason and what can be done about it?
Here are the results of three different statements ( measured with ticks_cpu() ) :
v1.20.0 WeAct
1: 325330
2: 283260
3: 326694
v1.21 Pimoroni PicoLipo
1: 319496
2: 273826
3: 318965
v1.22.2 WeAct
1: 915635
2: 890955
3: 932455
v1.22.2 Pimoroni 16MB on PICO BOOT
1: 915580
2: 891191
3: 932501
The differences are so great that you notice it because you have to wait longer for the results.
Beta Was this translation helpful? Give feedback.
All reactions