MicroPython _thread exercise
The purpose of this exercise is to test the behavior of MicroPython _thread, specifically for Raspberry Pi Pico series, whether _thread.start_new_thread() can provide real multi-core parallel speedup for pure Python CPU-bound work. mpy_thread_smp_bench.py # mpy_thread_smp_bench.py # # Purpose: # Simple MicroPython benchmark to test whether _thread.start_new_thread() # can provide real multi-core parallel speedup for pure Python CPU-bound work. # # Method: # 1. Run a CPU-bound loop in the main thread and measure the duration. # This is the single-thread baseline. # # 2. Run the same CPU-bound loop in two threads: # - one in the main thread # - one in a newly created _thread # # 3. Measure: # - duration of thread 0 # - duration of thread 1 # - total wall-clock time from starting both threads until both finish # # Interpretation: # Let single-thread duration be T. # # If the two CPU jobs run fully in parallel on two cores: # tot...