<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/tests/cmdline, branch 4.0.0-alpha.2</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=4.0.0-alpha.2</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=4.0.0-alpha.2'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2018-02-19T05:12:44+00:00</updated>
<entry>
<title>py/repl: Generalise REPL autocomplete to use qstr probing.</title>
<updated>2018-02-19T05:12:44+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-02-15T07:12:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=165aab12a3918004325238c794e27e7f4adbb401'/>
<id>urn:sha1:165aab12a3918004325238c794e27e7f4adbb401</id>
<content type='text'>
This patch changes the way REPL autocomplete finds matches.  It now probes
the target object for all qstrs via mp_load_method_maybe to look for a
match with the given input string.  Similar to how the builtin dir()
function works, this new algorithm now find all methods and instances of
user-defined classes including attributes of their parent classes.  This
helps a lot at the REPL prompt for user-discovery and to autocomplete names
even for classes that are derived.

The downside is that this new algorithm is slower than the previous one,
and in particular will be slower the more qstrs there are in the system.
But because REPL autocomplete is primarily used in an interactive way it is
not that important to make it fast, as long as it is "fast enough" compared
to human reaction.

On a slow microcontroller (CPU running at 16MHz) the autocomplete time for
a list of 35 names in the outer namespace (pressing tab at a bare prompt)
takes about 160ms with this algorithm, compared to about 40ms for the
previous implementation (this time includes the actual printing of the
names as well).  This time of 160ms is very reasonable especially given the
new functionality of listing all the names.

This patch also decreases code size by:

   bare-arm:    +0
minimal x86:  -128
   unix x64:  -128
unix nanbox:  -224
      stm32:   -88
     cc3200:   -80
    esp8266:   -92
      esp32:   -84
</content>
</entry>
<entry>
<title>tests: Add some more tests to improve coverage of py/parse.c.</title>
<updated>2017-12-19T05:13:00+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-12-19T05:13:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=35a759dc1dae33d62d005fe44f3cda4599a3c297'/>
<id>urn:sha1:35a759dc1dae33d62d005fe44f3cda4599a3c297</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py: Clean up unary and binary enum list to keep groups together.</title>
<updated>2017-10-04T23:49:44+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-10-03T12:34:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=0864a6957fe4717c3ec40ceeb373b19614a18434'/>
<id>urn:sha1:0864a6957fe4717c3ec40ceeb373b19614a18434</id>
<content type='text'>
2 non-bytecode binary ops (NOT_IN and IN_NOT) are moved out of the
bytecode group, so this change will change the bytecode format.
</content>
</entry>
<entry>
<title>py: Clarify which mp_unary_op_t's may appear in the bytecode.</title>
<updated>2017-09-25T23:35:19+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2017-09-25T23:35:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=9d836fedbdb1d28bdfc4ba475bbdfc1adb3f007a'/>
<id>urn:sha1:9d836fedbdb1d28bdfc4ba475bbdfc1adb3f007a</id>
<content type='text'>
Not all can, so we don't need to reserve bytecodes for them, and can
use free slots for something else later.
</content>
</entry>
<entry>
<title>py/runtime0.h: Put inplace arith ops in front of normal operations.</title>
<updated>2017-09-07T21:10:10+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2017-09-07T21:10:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=b8ee7ab5b988f424e34e778fe3a679710d675efa'/>
<id>urn:sha1:b8ee7ab5b988f424e34e778fe3a679710d675efa</id>
<content type='text'>
This is to allow to place reverse ops immediately after normal ops, so
they can be tested as one range (which is optimization for reverse ops
introduction in the next patch).
</content>
</entry>
<entry>
<title>py/runtime0.h: Move MP_BINARY_OP_DIVMOD to the end of mp_binary_op_t.</title>
<updated>2017-09-07T08:26:42+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2017-09-07T08:26:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=50b9329eba29a36b6948699aaea9473681d4f46b'/>
<id>urn:sha1:50b9329eba29a36b6948699aaea9473681d4f46b</id>
<content type='text'>
It starts a dichotomy of mp_binary_op_t values which can't appear in the
bytecode. Another reason to move it is to VALUES of OP_* and OP_INPLACE_*
nicely adjacent. This also will be needed for OP_REVERSE_*, to be soon
introduced.
</content>
</entry>
<entry>
<title>py/runtime0.h: Move relational ops to the beginning of mp_binary_op_t.</title>
<updated>2017-09-07T07:55:43+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2017-09-07T07:55:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=d4d1c45a553c6361a72053383f0fe242f05cad3d'/>
<id>urn:sha1:d4d1c45a553c6361a72053383f0fe242f05cad3d</id>
<content type='text'>
This is to allow to encode arithmetic operations more efficiently, in
preparation to introduction of __rOP__ method support.
</content>
</entry>
<entry>
<title>tests: Add tests for calling super and loading a method directly.</title>
<updated>2017-04-22T13:39:38+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-04-18T23:49:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=30badd1ce1fabd26e54fc445f07846306aa19cef'/>
<id>urn:sha1:30badd1ce1fabd26e54fc445f07846306aa19cef</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/compile: Refactor handling of special super() call.</title>
<updated>2017-04-22T11:46:32+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-04-18T12:52:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=5335942b599d85263d3c18eb99ff5ebd04a8bc98'/>
<id>urn:sha1:5335942b599d85263d3c18eb99ff5ebd04a8bc98</id>
<content type='text'>
This patch refactors the handling of the special super() call within the
compiler.  It removes the need for a global (to the compiler) state variable
which keeps track of whether the subject of an expression is super.  The
handling of super() is now done entirely within one function, which makes
the compiler a bit cleaner and allows to easily add more optimisations to
super calls.

Changes to the code size are:

   bare-arm: +12
    minimal:  +0
   unix x64: +48
unix nanbox: -16
     stmhal:  +4
     cc3200:  +0
    esp8266: -56
</content>
</entry>
<entry>
<title>py: Create str/bytes objects in the parser, not the compiler.</title>
<updated>2017-02-24T02:43:43+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-02-24T02:43:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=5255255fb9ea003db65935fe6cf2ac9d17410faa'/>
<id>urn:sha1:5255255fb9ea003db65935fe6cf2ac9d17410faa</id>
<content type='text'>
Previous to this patch any non-interned str/bytes objects would create a
special parse node that held a copy of the str/bytes data.  Then in the
compiler this data would be turned into a str/bytes object.  This actually
lead to 2 copies of the data, one in the parse node and one in the object.
The parse node's copy of the data would be freed at the end of the compile
stage but nevertheless it meant that the peak memory usage of the
parse/compile stage was higher than it needed to be (by an amount equal to
the number of bytes in all the non-interned str/bytes objects).

This patch changes the behaviour so that str/bytes objects are created
directly in the parser and the object stored in a const-object parse node
(which already exists for bignum, float and complex const objects).  This
reduces peak RAM usage of the parse/compile stage, simplifies the parser
and compiler, and reduces code size by about 170 bytes on Thumb2 archs,
and by about 300 bytes on Xtensa archs.
</content>
</entry>
</feed>
