<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/py/qstr.c, branch v1.6</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=v1.6</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=v1.6'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2015-12-17T12:41:40+00:00</updated>
<entry>
<title>py/qstr: Use size_t instead of mp_uint_t when counting allocated bytes.</title>
<updated>2015-12-17T12:41:40+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-12-17T12:41:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=257848587fb03879e145a34c8065927cf4d1532f'/>
<id>urn:sha1:257848587fb03879e145a34c8065927cf4d1532f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py: Change qstr_* functions to use size_t as the type for str len arg.</title>
<updated>2015-11-29T14:25:04+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-11-27T12:23:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=c3f64d9799cdf8af88087eebe6628e83d658405c'/>
<id>urn:sha1:c3f64d9799cdf8af88087eebe6628e83d658405c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/qstr: Fix calc of qstr memory usage, due to new qstr chunk allocation.</title>
<updated>2015-10-13T14:52:06+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-10-13T14:52:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=59a41e8fcdb80c1ee025ba782c69a8077b214602'/>
<id>urn:sha1:59a41e8fcdb80c1ee025ba782c69a8077b214602</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py: Make qstr hash size configurable, defaults to 2 bytes.</title>
<updated>2015-07-20T11:03:13+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-07-20T11:03:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=c3bd9415cc8e6ba3619fe4b7a2bdac20260b0236'/>
<id>urn:sha1:c3bd9415cc8e6ba3619fe4b7a2bdac20260b0236</id>
<content type='text'>
This patch makes configurable, via MICROPY_QSTR_BYTES_IN_HASH, the
number of bytes used for a qstr hash.  It was originally fixed at 2
bytes, and now defaults to 2 bytes.  Setting it to 1 byte will save
ROM and RAM at a small expense of hash collisions.
</content>
</entry>
<entry>
<title>py: Improve allocation policy of qstr data.</title>
<updated>2015-07-14T21:56:32+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-06-13T20:53:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=ade9a052365247be5ed4ce8b53c2164a576a4a05'/>
<id>urn:sha1:ade9a052365247be5ed4ce8b53c2164a576a4a05</id>
<content type='text'>
Previous to this patch all interned strings lived in their own malloc'd
chunk.  On average this wastes N/2 bytes per interned string, where N is
the number-of-bytes for a quanta of the memory allocator (16 bytes on 32
bit archs).

With this patch interned strings are concatenated into the same malloc'd
chunk when possible.  Such chunks are enlarged inplace when possible,
and shrunk to fit when a new chunk is needed.

RAM savings with this patch are highly varied, but should always show an
improvement (unless only 3 or 4 strings are interned).  New version
typically uses about 70% of previous memory for the qstr data, and can
lead to savings of around 10% of total memory footprint of a running
script.

Costs about 120 bytes code size on Thumb2 archs (depends on how many
calls to gc_realloc are made).
</content>
</entry>
<entry>
<title>py: Convert occurrences of non-debug printf to mp_printf.</title>
<updated>2015-04-16T14:30:16+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-04-11T11:15:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=e72cda99fd5fc9e7c6476eb8574c4401d3ef9560'/>
<id>urn:sha1:e72cda99fd5fc9e7c6476eb8574c4401d3ef9560</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py: Add option to micropython.qstr_info() to dump actual qstrs.</title>
<updated>2015-02-10T11:02:28+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-02-10T11:02:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=ea0461dcd390135561651036f39606d50ce12999'/>
<id>urn:sha1:ea0461dcd390135561651036f39606d50ce12999</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py, unix: Allow to compile with -Wsign-compare.</title>
<updated>2015-01-16T17:47:07+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-01-16T17:47:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=963a5a3e82ded7ee75adae72ae7cb14796fa150e'/>
<id>urn:sha1:963a5a3e82ded7ee75adae72ae7cb14796fa150e</id>
<content type='text'>
See issue #699.
</content>
</entry>
<entry>
<title>py: Never intern data of large string/bytes object; add relevant tests.</title>
<updated>2015-01-13T16:21:23+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-01-13T16:21:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=4c81ba8015238a343593468aa5173440fd392e32'/>
<id>urn:sha1:4c81ba8015238a343593468aa5173440fd392e32</id>
<content type='text'>
Previously to this patch all constant string/bytes objects were
interned by the compiler, and this lead to crashes when the qstr was too
long (noticeable now that qstr length storage defaults to 1 byte).

With this patch, long string/bytes objects are never interned, and are
referenced directly as constant objects within generated code using
load_const_obj.
</content>
</entry>
<entry>
<title>py: Add MICROPY_QSTR_BYTES_IN_LEN config option, defaulting to 1.</title>
<updated>2015-01-11T22:27:30+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-01-11T22:27:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=95836f8439b9f1ca0b6ff20f56a03253aa9ba836'/>
<id>urn:sha1:95836f8439b9f1ca0b6ff20f56a03253aa9ba836</id>
<content type='text'>
This new config option sets how many fixed-number-of-bytes to use to
store the length of each qstr.  Previously this was hard coded to 2,
but, as per issue #1056, this is considered overkill since no-one
needs identifiers longer than 255 bytes.

With this patch the number of bytes for the length is configurable, and
defaults to 1 byte.  The configuration option filters through to the
makeqstrdata.py script.

Code size savings going from 2 to 1 byte:
- unix x64 down by 592 bytes
- stmhal down by 1148 bytes
- bare-arm down by 284 bytes

Also has RAM savings, and will be slightly more efficient in execution.
</content>
</entry>
</feed>
