Skip to content

Commit 155ec21

Browse files
committed
docs/glossary: Describe string interning.
1 parent 3a431fb commit 155ec21

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

docs/reference/glossary.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,22 @@ Glossary
6464
properties of these pins (e.g. controllable by the same
6565
register).
6666

67+
interned string
68+
A string referenced by its (unique) identity rather than its
69+
address. Interned strings are thus can be quickly compared just
70+
by their identifiers, instead of comparing by content. The
71+
drawbacks of interned strings are that interning operation takes
72+
time (proportional to the number of existing interned strings,
73+
i.e. becoming slower and slower over time) and that the space
74+
used for interned strings is not reclaimable. String interning
75+
is done automatically by MicroPython compiler and runtimer when
76+
it's either required by the implementation (e.g. function keyword
77+
arguments are represented by interned string id's) or deemed
78+
beneficial (e.g. for short enough strings, which have a chance
79+
to be repeated, and thus interning them would save memory on
80+
copies). Most of string and I/O operations don't produce interned
81+
strings due to drawbacks described above.
82+
6783
MCU
6884
Microcontroller. Microcontrollers usually have much less resources
6985
than a full-fledged computing system, but smaller, cheaper and

0 commit comments

Comments
 (0)