<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/tests/misc, branch 5.0.0-beta.4</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=5.0.0-beta.4</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=5.0.0-beta.4'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2018-07-11T20:45:30+00:00</updated>
<entry>
<title>WIP: after merge; before testing</title>
<updated>2018-07-11T20:45:30+00:00</updated>
<author>
<name>Dan Halbert</name>
<email>halbert@halwitz.org</email>
</author>
<published>2018-07-11T20:45:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=7c219600a246d8956d0b23ea3f5d125a820e6b6a'/>
<id>urn:sha1:7c219600a246d8956d0b23ea3f5d125a820e6b6a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>tests: Add tests using "file" argument in print and sys.print_exception.</title>
<updated>2018-06-20T06:08:25+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-06-20T06:08:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=b92a8adbfa54dc259554b435a81b6cec19cae99a'/>
<id>urn:sha1:b92a8adbfa54dc259554b435a81b6cec19cae99a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/objtype: Optimise instance get/set/del by skipping special accessors.</title>
<updated>2018-06-08T02:12:08+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-05-25T07:09:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=36c105218321167d47b0fb67575a7cddc36d17e7'/>
<id>urn:sha1:36c105218321167d47b0fb67575a7cddc36d17e7</id>
<content type='text'>
This patch is a code optimisation, trading text bytes for speed.  On
pyboard it's an increase of 0.06% in code size for a gain (in pystone
performance) of roughly 6.5%.

The patch optimises load/store/delete of attributes in user defined classes
by not looking up special accessors (@property, __get__, __delete__,
__set__, __setattr__ and __getattr_) if they are guaranteed not to exist in
the class.

Currently, if you do my_obj.foo() then the runtime has to do a few checks
to see if foo is a property or has __get__, and if so delegate the call.
And for stores things like my_obj.foo = 1 has to first check if foo is a
property or has __set__ defined on it.

Doing all those checks each and every time the attribute is accessed has a
performance penalty.  This patch eliminates all those checks for cases when
it's guaranteed that the checks will always fail, ie no attributes are
properties nor have any special accessor methods defined on them.

To make this guarantee it checks all attributes of a user-defined class
when it is first created.  If any of the attributes of the user class are
properties or have special accessors, or any of the base classes of the
user class have them, then it sets a flag in the class to indicate that
special accessors must be checked for.  Then in the load/store/delete code
it checks this flag to see if it can take the shortcut and optimise the
lookup.

It's an optimisation that's pretty widely applicable because it improves
lookup performance for all methods of user defined classes, and stores of
attributes, at least for those that don't have special accessors.  And, it
allows to enable descriptors with minimal additional runtime overhead if
they are not used for a particular user class.

There is one restriction on dynamic class creation that has been introduced
by this patch: a user-defined class cannot go from zero special accessors
to one special accessor (or more) after that class has been subclassed.  If
the script attempts this an AttributeError is raised (see addition to
tests/misc/non_compliant.py for an example of this case).

The cost in code space bytes for the optimisation in this patch is:

   unix x64:  +528
unix nanbox:  +508
      stm32:  +192
     cc3200:  +200
    esp8266:  +332
      esp32:  +244

Performance tests that were done:

- on unix x86-64, pystone improved by about 5%
- on pyboard, pystone improved by about 6.5%, from 1683 up to 1794
- on pyboard, bm_chaos (from CPython benchmark suite) improved by about 5%
- on esp32, pystone improved by about 30% (but there are caching effects)
- on esp32, bm_chaos improved by about 11%
</content>
</entry>
<entry>
<title>tests: Move recursive tests to the tests/stress/ subdir.</title>
<updated>2018-04-10T04:43:52+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-04-10T04:42:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=5ad27d4b8bb248954d98178e068a382599dadfa6'/>
<id>urn:sha1:5ad27d4b8bb248954d98178e068a382599dadfa6</id>
<content type='text'>
Keeping all the stress related tests in one place makes it easier to
stress-test a given port, and to also not run such tests on ports that
can't handle them.
</content>
</entry>
<entry>
<title>tests: Add tests to improve coverage of py/objtype.c.</title>
<updated>2017-12-14T01:25:30+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-12-14T01:25:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=36f79523abe8d79fec1cc7af41e8e96e8ceb2cc4'/>
<id>urn:sha1:36f79523abe8d79fec1cc7af41e8e96e8ceb2cc4</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Merge commit 'f869d6b2e339c04469c6c9ea3fb2fabd7bbb2d8c' into nrf2_merge</title>
<updated>2017-10-25T05:31:16+00:00</updated>
<author>
<name>Scott Shawcroft</name>
<email>scott.shawcroft@gmail.com</email>
</author>
<published>2017-10-25T05:31:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=73c15dcf8b1b927757a595a867334b38355ddb8f'/>
<id>urn:sha1:73c15dcf8b1b927757a595a867334b38355ddb8f</id>
<content type='text'>
This is prep for merging in the NRF5 pull request.
</content>
</entry>
<entry>
<title>CircuitPython now has struct instead of ustruct (#302)</title>
<updated>2017-10-18T19:50:20+00:00</updated>
<author>
<name>Michael McWethy</name>
<email>mrmcwethy@yahoo.com</email>
</author>
<published>2017-10-18T19:50:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=b41cbe9256d3f7105a70ad3d2e4fb64180f81e09'/>
<id>urn:sha1:b41cbe9256d3f7105a70ad3d2e4fb64180f81e09</id>
<content type='text'>
Added struct module to shared-bindings and shared-module.  removed ustruct</content>
</entry>
<entry>
<title>py/objset: Check that RHS of a binary op is a set/frozenset.</title>
<updated>2017-10-03T06:56:27+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-10-03T06:56:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=2ac1364688cd3ee313661e82a336663551986fc8'/>
<id>urn:sha1:2ac1364688cd3ee313661e82a336663551986fc8</id>
<content type='text'>
CPython docs explicitly state that the RHS of a set/frozenset binary op
must be a set to prevent user errors.  It also preserves commutativity of
the ops, eg: "abc" &amp; set() is a TypeError, and so should be set() &amp; "abc".

This change actually decreases unix (x64) code by 160 bytes; it increases
stm32 by 4 bytes and esp8266 by 28 bytes (but previous patch already
introduced a much large saving).
</content>
</entry>
<entry>
<title>tests: Convert remaining "sys.exit()" to "raise SystemExit".</title>
<updated>2017-06-10T17:34:38+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2017-06-10T17:14:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=85d809d1f4e35a511e0a56b3411126e05a31c01b'/>
<id>urn:sha1:85d809d1f4e35a511e0a56b3411126e05a31c01b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>tests/misc/: Make few tests skippable.</title>
<updated>2017-03-11T00:17:02+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2017-03-11T00:16:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=3e321f1724b4e2deae2a7750c789c6423f5201c2'/>
<id>urn:sha1:3e321f1724b4e2deae2a7750c789c6423f5201c2</id>
<content type='text'>
</content>
</entry>
</feed>
