@@ -1288,12 +1288,11 @@ asyncio
12881288 :meth: `asyncio.TaskGroup.create_task `.
12891289 (Contributed by Thomas Grainger in :gh: `128307 `.)
12901290
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 `.)
12971296
12981297
12991298 .. _whatsnew314-color-calendar :
@@ -1521,36 +1520,6 @@ functools
15211520 (Contributed by Sayandip Dutta in :gh: `125916 `.)
15221521
15231522
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-
15541523getopt
15551524------
15561525
@@ -1919,13 +1888,6 @@ pdb
19191888* ``$_asynctask `` is added to access the current asyncio task if applicable.
19201889 (Contributed by Tian Gao in :gh: `124367 `.)
19211890
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-
19291891* :func: `pdb.set_trace_async ` is added to support debugging asyncio
19301892 coroutines. :keyword: `await ` statements are supported with this
19311893 function.
@@ -2266,14 +2228,16 @@ zipinfo
22662228
22672229.. Add improved modules above alphabetically, not here at the end.
22682230
2231+
22692232 Optimizations
22702233=============
22712234
22722235* 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 `.
22772241
22782242 (Contributed by Adam Turner, Bénédikt Tran, Chris Markiewicz, Eli Schwartz,
22792243 Hugo van Kemenade, Jelle Zijlstra, and others in :gh: `118761 `.)
@@ -2282,32 +2246,44 @@ Optimizations
22822246asyncio
22832247-------
22842248
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.
22882253 This enables external introspection tools such as
22892254 :ref: `python -m asyncio pstree <whatsnew314-asyncio-introspection >`
22902255 to introspect the call graph of asyncio tasks running in all threads.
22912256 (Contributed by Kumar Aditya in :gh: `107803 `.)
22922257
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.
22962262 (Contributed by Kumar Aditya in :gh: `128002 `.)
22972263
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-
23042264
23052265base64
23062266------
23072267
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 `.)
23112287
23122288
23132289gc
@@ -2316,42 +2292,90 @@ gc
23162292* The new :ref: `incremental garbage collector <whatsnew314-incremental-gc >`
23172293 means that maximum pause times are reduced
23182294 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+
23192321 (Contributed by Mark Shannon in :gh: `108362 `.)
23202322
23212323
23222324io
23232325---
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 `.)
23302351
23312352
23322353uuid
23332354----
23342355
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 `.)
23422360
2361+ * :func: `~uuid.uuid4 ` is now c. 30% faster.
23432362 (Contributed by Bénédikt Tran in :gh: `128150 `.)
23442363
23452364
23462365zlib
23472366----
23482367
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+
23552379 (Contributed by Steve Dower in :gh: `91349 `.)
23562380
23572381
0 commit comments