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