@@ -11,9 +11,8 @@ available processing power by running threads in parallel on available CPU cores
1111While not all software will benefit from this automatically, programs
1212designed with threading in mind will run faster on multi-core hardware.
1313
14- The free-threaded mode is working and continues to be improved, but
15- there is some additional overhead in single-threaded workloads compared
16- to the regular build. Additionally, third-party packages, in particular ones
14+ The free-threaded mode continues to be improved with each release.
15+ Additionally, third-party packages, in particular ones
1716with an :term: `extension module `, may not be ready for use in a
1817free-threaded build, and will re-enable the :term: `GIL `.
1918
@@ -101,61 +100,48 @@ This section describes known limitations of the free-threaded CPython build.
101100Immortalization
102101---------------
103102
104- The free-threaded build of the 3.13 release makes some objects :term: `immortal `.
103+ In the free-threaded build, some objects are :term: `immortal `.
105104Immortal objects are not deallocated and have reference counts that are
106- never modified. This is done to avoid reference count contention that would
105+ never modified. This is done to avoid reference count contention that would
107106prevent efficient multi-threaded scaling.
108107
109- An object will be made immortal when a new thread is started for the first time
110- after the main thread is running. The following objects are immortalized:
108+ As of the 3.14 release, immortalization is limited to:
111109
112- * :ref: `function <user-defined-funcs >` objects declared at the module level
113- * :ref: `method <instance-methods >` descriptors
114- * :ref: `code <code-objects >` objects
115- * :term: `module ` objects and their dictionaries
116- * :ref: `classes <classes >` (type objects)
117-
118- Because immortal objects are never deallocated, applications that create many
119- objects of these types may see increased memory usage. This overhead was removed
120- in the 3.14 release.
121-
122- Additionally, numeric and string literals in the code as well as strings
123- returned by :func: `sys.intern ` are also immortalized. This behavior remains
124- in the 3.14 free-threaded build.
110+ * Code constants: numeric literals, string literals, and tuple literals
111+ composed of other constants.
112+ * Strings returned by :func: `sys.intern `.
125113
126114
127115Frame objects
128116-------------
129117
130118It is not safe to access :ref: `frame <frame-objects >` objects from other
131- threads and doing so may cause your program to crash . This means that
119+ threads. This means that
132120:func: `sys._current_frames ` is generally not safe to use in a free-threaded
133- build. Functions like :func: `inspect.currentframe ` and :func: `sys._getframe `
121+ build. Functions like :func: `inspect.currentframe ` and :func: `sys._getframe `
134122are generally safe as long as the resulting frame object is not passed to
135123another thread.
136124
137125Iterators
138126---------
139127
140- Sharing the same iterator object between multiple threads is generally not
141- safe and threads may see duplicate or missing elements when iterating or crash
142- the interpreter.
128+ While sharing the same iterator object between multiple threads is generally not
129+ safe from a logical perspective (threads may see duplicate or missing elements
130+ when iterating), the 3.14 free-threaded build prevents interpreter crashes
131+ that occurred in earlier versions.
143132
144133
145134Single-threaded performance
146135---------------------------
147136
148137The free-threaded build has additional overhead when executing Python code
149- compared to the default GIL-enabled build. In 3.13, this overhead is about
150- 40% on the `pyperformance <https://pyperformance.readthedocs.io/ >`_ suite.
138+ compared to the default GIL-enabled build. This overhead was reduced
139+ in the 3.14 release (which re-enabled the specializing adaptive
140+ interpreter, :pep: `659 `). Reducing this overhead further remains an
141+ active development goal, with an aim for 10% or less on the
142+ `pyperformance <https://pyperformance.readthedocs.io/ >`_ suite compared to the default GIL-enabled build.
151143Programs that spend most of their time in C extensions or I/O will see
152- less of an impact. The largest impact is because the specializing adaptive
153- interpreter (:pep: `659 `) is disabled in the free-threaded build. We expect
154- to re-enable it in a thread-safe way in the 3.14 release. This overhead is
155- expected to be reduced in upcoming Python release. This overhead was reduced
156- in the 3.14 release. Reducing overhead further remains an active development goal,
157- with an aim for 10% or less on the pyperformance suite compared to the default GIL-enabled
158- build.
144+ less of an impact.
159145
160146
161147Behavioral changes
0 commit comments