micropython vs python3 performance
Closed this issue · 2 comments
python3 takes 250ms
time ./usr/bin/rubiks-color-resolver-micropython.py --filename test-data/3x3x3-random-08.txt
micropython takes ~1050ms
time ./usr/bin/rubiks-color-resolver-micropython.py --filename test-data/3x3x3-random-08.txt
Why is micropython 4x slower than python? You cannot do -m cProfile
with micropython to profile it. With python3 most of the time is spent in delta_e_cie2000()
but I do not know that that is the case with micropython. Note that with python3 we are caching the cie2000 results, if we turn that off it still only takes ~420ms.
Find a way to profile micropython so we can figure out why the perf is so bad.
Perf suggestions here:
http://docs.micropython.org/en/v1.9.3/pyboard/reference/speed_python.html
and this post suggest that creating float objects is very expensive
https://forum.micropython.org/viewtopic.php?t=262#p1265
Try creating const()
for as many things in delta_e_cie2000
as possible.