Try to change this function from earthworm modeTo a native snakeAnd give it some venom to be like a viperAnd see the results changing drastically.
BTW your RISC-V version looks to be better compiled than the stock one
Maybe the differences are form some not so well optimized interpreter code.
RISC-VARM
Code:
def Fibonacci(n): if n <= 1 : return n else : return Fibonacci(n-1) + Fibonacci(n-2)Code:
@micropython.nativedef Fibonacci(n): if n <= 1 : return n else : return Fibonacci(n-1) + Fibonacci(n-2)Code:
@micropython.viperdef Fibonacci( n: int) -> int: if n <= 1 : return int(n) else : return int( Fibonacci(n-1) + Fibonacci(n-2) )BTW your RISC-V version looks to be better compiled than the stock one
Maybe the differences are form some not so well optimized interpreter code.
RISC-V
Code:
.----------.------------.-------.------------.-------------.| Hardware | Python | MHz | Seconds | Multiplier ||----------|------------|-------|------------|-------------|| RP2350 | 1.24.0 on | 250 | 0.238593 | 15 7.7 ||RISCVviper| 2024-10-25 | 125 | 0.477184 | 8 7.7 |`----------^------------^-------^------------^-------------'.----------.------------.-------.------------.-------------.| Hardware | Python | MHz | Seconds | Multiplier ||----------|------------|-------|------------|-------------|| RP2350 | 1.24.0 on | 250 | 0.468229 | 8 3.9 ||RISCVnativ| 2024-10-25 | 125 | 0.936364 | 4 3.9 |`----------^------------^-------^------------^-------------'.----------.------------.-------.------------.-------------.| Hardware | Python | MHz | Seconds | Multiplier ||----------|------------|-------|------------|-------------|| RP2350 | 1.24.0 on | 250 | 1.346400 | 3 1.4 || RISCV | 2024-10-25 | 125 | 2.692783 | 1 1.4 |`----------^------------^-------^------------^-------------'Code:
.----------.------------.-------.------------.-------------.| Hardware | Python | MHz | Seconds | Multiplier ||----------|------------|-------|------------|-------------|| RP2350 | 1.24.0 on | 250 | 0.271833 | 14 6.8 ||ARM viper | 2024-10-25 | 125 | 0.543536 | 7 6.8 |`----------^------------^-------^------------^-------------'.----------.------------.-------.------------.-------------.| Hardware | Python | MHz | Seconds | Multiplier ||----------|------------|-------|------------|-------------|| RP2350 | 1.24.0 on | 250 | 0.531003 | 7 3.5 ||ARM native| 2024-10-25 | 125 | 1.061867 | 3 3.5 |`----------^------------^-------^------------^-------------'.----------.------------.-------.------------.-------------.| Hardware | Python | MHz | Seconds | Multiplier ||----------|------------|-------|------------|-------------|| RP2350 | 1.24.0 on (| 250 | 0.561808 | 7 3.3 || ARM | 2024-10-25 | 125 | 1.123654 | 3 3.3 |`----------^------------^-------^------------^-------------'Statistics: Posted by gmx — Mon Nov 11, 2024 4:49 am