[Microbit-Python] Slowness as integers move beyond 256

M.-A. Lemburg mal at egenix.com
Tue Jan 5 17:55:53 EST 2016


[Sorry, hit send to early]

I've been playing with MicroPython a bit and noticed a strange
behavior: integer math gets rather slow when reaching numbers
above 256.

Run the attached script as example. It produces a wave on the
LED display and runs quite nicely until the offset reaches 251.
Performance then drops to about half the speed.

Is this known behavior and expected ?

I also noticed that the script stops when the offset reaches 500
with a MemoryError, even though the data structure for the LEDs
is modified in place, so perhaps it's not the math that's slowing
things down, but instead some memory leak.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Experts (#1, Jan 05 2016)
>>> Python Projects, Coaching and Consulting ...  http://www.egenix.com/
>>> Python Database Interfaces ...           http://products.egenix.com/
>>> Plone/Zope Database Interfaces ...           http://zope.egenix.com/
________________________________________________________________________

::: We implement business ideas - efficiently in both time and costs :::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/
                      http://www.malemburg.com/


-------------- next part --------------
A non-text attachment was scrubbed...
Name: waves.py
Type: text/x-python
Size: 801 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/microbit/attachments/20160105/2a063470/attachment.py>


More information about the Microbit mailing list