@@ -1288,12 +1288,11 @@ asyncio
1288
1288
:meth: `asyncio.TaskGroup.create_task `.
1289
1289
(Contributed by Thomas Grainger in :gh: `128307 `.)
1290
1290
1291
-
1292
- bdb
1293
- ---
1294
-
1295
- * The :mod: `bdb ` module now supports the :mod: `sys.monitoring ` backend.
1296
- (Contributed by Tian Gao in :gh: `124533 `.)
1291
+ * There are two new utility functions for
1292
+ introspecting and printing a program's call graph:
1293
+ :func: `~asyncio.capture_call_graph ` and :func: `~asyncio.print_call_graph `.
1294
+ (Contributed by Yury Selivanov, Pablo Galindo Salgado, and Łukasz Langa
1295
+ in :gh: `91048 `.)
1297
1296
1298
1297
1299
1298
.. _whatsnew314-color-calendar :
@@ -1521,36 +1520,6 @@ functools
1521
1520
(Contributed by Sayandip Dutta in :gh: `125916 `.)
1522
1521
1523
1522
1524
- gc
1525
- --
1526
-
1527
- The cyclic garbage collector is now incremental,
1528
- which changes the meaning of the results of
1529
- :meth: `~gc.get_threshold ` and :meth: `~gc.set_threshold `
1530
- as well as :meth: `~gc.get_count ` and :meth: `~gc.get_stats `.
1531
-
1532
- * For backwards compatibility, :meth: `~gc.get_threshold ` continues to return
1533
- a three-item tuple.
1534
- The first value is the threshold for young collections, as before;
1535
- the second value determines the rate at which the old collection is scanned
1536
- (the default is 10, and higher values mean that the old collection
1537
- is scanned more slowly).
1538
- The third value is meaningless and is always zero.
1539
-
1540
- * :meth: `~gc.set_threshold ` ignores any items after the second.
1541
-
1542
- * :meth: `~gc.get_count ` and :meth: `~gc.get_stats ` continue to return
1543
- the same format of results.
1544
- The only difference is that instead of the results referring to
1545
- the young, aging and old generations,
1546
- the results refer to the young generation
1547
- and the aging and collecting spaces of the old generation.
1548
-
1549
- In summary, code that attempted to manipulate the behavior of the cycle GC
1550
- may not work exactly as intended, but it is very unlikely to be harmful.
1551
- All other code will work just fine.
1552
-
1553
-
1554
1523
getopt
1555
1524
------
1556
1525
@@ -1919,13 +1888,6 @@ pdb
1919
1888
* ``$_asynctask `` is added to access the current asyncio task if applicable.
1920
1889
(Contributed by Tian Gao in :gh: `124367 `.)
1921
1890
1922
- * :mod: `pdb ` now supports two backends: :func: `sys.settrace ` and
1923
- :mod: `sys.monitoring `. Using :mod: `pdb ` CLI or :func: `breakpoint ` will
1924
- always use the :mod: `sys.monitoring ` backend. Explicitly instantiating
1925
- :class: `pdb.Pdb ` and its derived classes will use the :func: `sys.settrace `
1926
- backend by default, which is configurable.
1927
- (Contributed by Tian Gao in :gh: `124533 `.)
1928
-
1929
1891
* :func: `pdb.set_trace_async ` is added to support debugging asyncio
1930
1892
coroutines. :keyword: `await ` statements are supported with this
1931
1893
function.
@@ -2266,14 +2228,16 @@ zipinfo
2266
2228
2267
2229
.. Add improved modules above alphabetically, not here at the end.
2268
2230
2231
+
2269
2232
Optimizations
2270
2233
=============
2271
2234
2272
2235
* The import time for several standard library modules has been improved,
2273
- including :mod: `ast `, :mod: `asyncio `, :mod: `base64 `, :mod: `cmd `, :mod: `csv `,
2274
- :mod: `gettext `, :mod: `importlib.util `, :mod: `locale `, :mod: `mimetypes `,
2275
- :mod: `optparse `, :mod: `pickle `, :mod: `pprint `, :mod: `pstats `, :mod: `socket `,
2276
- :mod: `subprocess `, :mod: `threading `, :mod: `tomllib `, and :mod: `zipfile `.
2236
+ including :mod: `annotationlib `, :mod: `ast `, :mod: `asyncio `, :mod: `base64 `,
2237
+ :mod: `cmd `, :mod: `csv `, :mod: `gettext `, :mod: `importlib.util `, :mod: `locale `,
2238
+ :mod: `mimetypes `, :mod: `optparse `, :mod: `pickle `, :mod: `pprint `,
2239
+ :mod: `pstats `, :mod: `shlex `, :mod: `socket `, :mod: `string `, :mod: `subprocess `,
2240
+ :mod: `threading `, :mod: `tomllib `, :mod: `types `, and :mod: `zipfile `.
2277
2241
2278
2242
(Contributed by Adam Turner, Bénédikt Tran, Chris Markiewicz, Eli Schwartz,
2279
2243
Hugo van Kemenade, Jelle Zijlstra, and others in :gh: `118761 `.)
@@ -2282,32 +2246,44 @@ Optimizations
2282
2246
asyncio
2283
2247
-------
2284
2248
2285
- * :mod: `asyncio ` has a new per-thread double linked list implementation internally for
2286
- :class: `native tasks <asyncio.Task> ` which speeds up execution by 10-20% on standard
2287
- pyperformance benchmarks and reduces memory usage.
2249
+ * Standard benchmark results have improved by 10-20%, following the
2250
+ implementation of a new per-thread double linked list
2251
+ for :class: `native tasks <asyncio.Task> `,
2252
+ also reducing memory usage.
2288
2253
This enables external introspection tools such as
2289
2254
:ref: `python -m asyncio pstree <whatsnew314-asyncio-introspection >`
2290
2255
to introspect the call graph of asyncio tasks running in all threads.
2291
2256
(Contributed by Kumar Aditya in :gh: `107803 `.)
2292
2257
2293
- * :mod: `asyncio ` has first class support for :term: `free-threading builds <free threading> `.
2294
- This enables parallel execution of multiple event loops across different threads and scales
2295
- linearly with the number of threads.
2258
+ * The module now has first class support for
2259
+ :term: `free-threading builds <free threading> `.
2260
+ This enables parallel execution of multiple event loops across
2261
+ different threads, scaling linearly with the number of threads.
2296
2262
(Contributed by Kumar Aditya in :gh: `128002 `.)
2297
2263
2298
- * :mod: `asyncio ` has new utility functions for introspecting and printing
2299
- the program's call graph: :func: `asyncio.capture_call_graph ` and
2300
- :func: `asyncio.print_call_graph `.
2301
- (Contributed by Yury Selivanov, Pablo Galindo Salgado, and Łukasz Langa
2302
- in :gh: `91048 `.)
2303
-
2304
2264
2305
2265
base64
2306
2266
------
2307
2267
2308
- * Improve the performance of :func: `base64.b16decode ` by up to ten times,
2309
- and reduce the import time of :mod: `base64 ` by up to six times.
2310
- (Contributed by Bénédikt Tran, Chris Markiewicz, and Adam Turner in :gh: `118761 `.)
2268
+ * :func: `~base64.b16decode ` is now up to six times faster.
2269
+ (Contributed by Bénédikt Tran, Chris Markiewicz, and Adam Turner
2270
+ in :gh: `118761 `.)
2271
+
2272
+
2273
+ bdb
2274
+ ---
2275
+
2276
+ * The basic debugger now has a :mod: `sys.monitoring `-based backend,
2277
+ which can be selected via the passing ``'monitoring' ``
2278
+ to the :class: `~bdb.Bdb ` class's new *backend * parameter.
2279
+ (Contributed by Tian Gao in :gh: `124533 `.)
2280
+
2281
+
2282
+ difflib
2283
+ -------
2284
+
2285
+ * The :func: `~difflib.IS_LINE_JUNK ` function is now up to twice as fast.
2286
+ (Contributed by Adam Turner and Semyon Moroz in :gh: `130167 `.)
2311
2287
2312
2288
2313
2289
gc
@@ -2316,42 +2292,90 @@ gc
2316
2292
* The new :ref: `incremental garbage collector <whatsnew314-incremental-gc >`
2317
2293
means that maximum pause times are reduced
2318
2294
by an order of magnitude or more for larger heaps.
2295
+
2296
+ Because of this optimization, the meaning of the results of
2297
+ :meth: `~gc.get_threshold ` and :meth: `~gc.set_threshold ` have changed,
2298
+ along with :meth: `~gc.get_count ` and :meth: `~gc.get_stats `.
2299
+
2300
+ - For backwards compatibility, :meth: `~gc.get_threshold ` continues to return
2301
+ a three-item tuple.
2302
+ The first value is the threshold for young collections, as before;
2303
+ the second value determines the rate at which the old collection is scanned
2304
+ (the default is 10, and higher values mean that the old collection
2305
+ is scanned more slowly).
2306
+ The third value is now meaningless and is always zero.
2307
+
2308
+ - :meth: `~gc.set_threshold ` now ignores any items after the second.
2309
+
2310
+ - :meth: `~gc.get_count ` and :meth: `~gc.get_stats ` continue to return
2311
+ the same format of results.
2312
+ The only difference is that instead of the results referring to
2313
+ the young, aging and old generations,
2314
+ the results refer to the young generation
2315
+ and the aging and collecting spaces of the old generation.
2316
+
2317
+ In summary, code that attempted to manipulate the behavior of the cycle GC
2318
+ may not work exactly as intended, but it is very unlikely to be harmful.
2319
+ All other code will work just fine.
2320
+
2319
2321
(Contributed by Mark Shannon in :gh: `108362 `.)
2320
2322
2321
2323
2322
2324
io
2323
2325
---
2324
- * :mod: `io ` which provides the built-in :func: `open ` makes less system calls
2325
- when opening regular files as well as reading whole files. Reading a small
2326
- operating system cached file in full is up to 15% faster.
2327
- :func: `pathlib.Path.read_bytes ` has the most optimizations for reading a
2328
- file's bytes in full. (Contributed by Cody Maloney and Victor Stinner in
2329
- :gh: `120754 ` and :gh: `90102 `.)
2326
+
2327
+ * Opening and reading files now executes fewer system calls.
2328
+ Reading a small operating system cached file in full is up to 15% faster.
2329
+ (Contributed by Cody Maloney and Victor Stinner
2330
+ in :gh: `120754 ` and :gh: `90102 `.)
2331
+
2332
+
2333
+ pathlib
2334
+ -------
2335
+
2336
+ * :func: `Path.read_bytes <pathlib.Path.read_bytes> ` now uses unbuffered mode
2337
+ to open files, which is between 9% and 17% faster to read in full.
2338
+ (Contributed by Cody Maloney in :gh: `120754 `.)
2339
+
2340
+
2341
+ pdb
2342
+ ---
2343
+
2344
+ * :mod: `pdb ` now supports two backends, based on either
2345
+ :func: `sys.settrace ` or :mod: `sys.monitoring `.
2346
+ Using the :ref: `pdb CLI <pdb-cli >` or :func: `breakpoint `
2347
+ will always use the :mod: `sys.monitoring ` backend.
2348
+ Explicitly instantiating :class: `pdb.Pdb ` and its derived classes
2349
+ will use the :func: `sys.settrace ` backend by default, which is configurable.
2350
+ (Contributed by Tian Gao in :gh: `124533 `.)
2330
2351
2331
2352
2332
2353
uuid
2333
2354
----
2334
2355
2335
- * Improve generation of :class: `~uuid.UUID ` objects via their dedicated
2336
- functions:
2337
-
2338
- * :func: `~uuid.uuid3 ` and :func: `~uuid.uuid5 ` are both roughly 40% faster
2339
- for 16-byte names and 20% faster for 1024-byte names. Performance for
2340
- longer names remains unchanged.
2341
- * :func: `~uuid.uuid4 ` is 30% faster.
2356
+ * :func: `~uuid.uuid3 ` and :func: `~uuid.uuid5 ` are now both roughly 40% faster
2357
+ for 16-byte names and 20% faster for 1024-byte names.
2358
+ Performance for longer names remains unchanged.
2359
+ (Contributed by Bénédikt Tran in :gh: `128150 `.)
2342
2360
2361
+ * :func: `~uuid.uuid4 ` is now c. 30% faster.
2343
2362
(Contributed by Bénédikt Tran in :gh: `128150 `.)
2344
2363
2345
2364
2346
2365
zlib
2347
2366
----
2348
2367
2349
- * On Windows, ``zlib-ng `` is now used as the implementation of the
2350
- :mod: `zlib ` module. This should produce compatible and comparable
2351
- results with better performance, though it is worth noting that
2352
- ``zlib.Z_BEST_SPEED `` (1) may result in significantly less
2353
- compression than the previous implementation (while also significantly
2354
- reducing the time taken to compress).
2368
+ * On Windows, `zlib-ng <https://github.com/zlib-ng/zlib-ng >`__
2369
+ is now used as the implementation of the :mod: `zlib ` module
2370
+ in the default binaries.
2371
+ There are no known incompatabilities between ``zlib-ng ``
2372
+ and the previously-used ``zlib `` implementation.
2373
+ This should result in better performance at all compression levels.
2374
+
2375
+ It is worth noting that ``zlib.Z_BEST_SPEED `` (``1 ``) may result in
2376
+ significantly less compression than the previous implementation,
2377
+ whilst also significantly reducing the time taken to compress.
2378
+
2355
2379
(Contributed by Steve Dower in :gh: `91349 `.)
2356
2380
2357
2381
0 commit comments