Micropython is faster than MMBasic :-(


Author Message
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 720
Posted: 02:51pm 24 Jul 2026      

  matherp said  One of my favourite benchmarks is the calculation of the solar eclipse.

solar_eclipse.zip

The data I use to test with is:
12,1,2000
39,40,36
-104,57,12
1644
30


Running on a HDMI build at 378 MHz this takes 13.23 seconds

Converting this to Micropython 1:1

solar_eclipse_py.zip

This runs in 8.77 seconds at 378MHz!

but Micropython has a trick up its sleeve using the ulab library

solar_eclipse_ulab.zip

And now it runs in 7.44 seconds

For reference if I run the Basic code on a 480MHz STM32H743 which has H/W double precision floating point it takes 7 seconds


I notice the BASIC version has a BASIC subroutine for matrix transpose. MMBasic has one built in. Would using the MATH subroutine be faster than the one written in BASIC?