diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-04-15 17:43:03 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-04-15 17:43:03 +0300 |
commit | 47f9b10b303abc9fd1cf637f2b62e97ab118cac0 (patch) | |
tree | 230b3a36417ade1577e8e9ec15ff58a1395f136c /docs/reference/speed_python.rst | |
parent | 6c84f1e03a87ff33a9130ff0527a74d4986ac3c5 (diff) | |
download | micropython-47f9b10b303abc9fd1cf637f2b62e97ab118cac0.tar.gz micropython-47f9b10b303abc9fd1cf637f2b62e97ab118cac0.zip |
docs/speed_python: Generalize "Floating point" subsection.
Don't describe just single port's peculiarities, note aboute possible
array of issues with floating-point.
Diffstat (limited to 'docs/reference/speed_python.rst')
-rw-r--r-- | docs/reference/speed_python.rst | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/docs/reference/speed_python.rst b/docs/reference/speed_python.rst index 31b5aeadda..86884a1577 100644 --- a/docs/reference/speed_python.rst +++ b/docs/reference/speed_python.rst @@ -67,10 +67,13 @@ to read data into an existing buffer. Floating Point ~~~~~~~~~~~~~~ -For the most speed critical sections of code it is worth noting that performing -any kind of floating point operation involves heap allocation. Where possible use -integer operations and restrict the use of floating point to sections of the code -where performance is not paramount. +Some MicroPython ports allocate floating point numbers on heap. Some other ports +may lack dedicated floating-point coprocessor, and perform arithmetic operations +on them in "software" at considerably lower speed than on integers. Where +performance is important, use integer operations and restrict the use of floating +point to sections of the code where performance is not paramount. For example, +capture ADC readings as integers values to an array in one quick go, and only then +convert them to floating-point numbers for signal processing. Arrays ~~~~~~ |