]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-33234: Add exact allocation optimization to lists in What's New (GH-10200)
authorPablo Galindo <Pablogsal@gmail.com>
Sun, 28 Oct 2018 22:03:18 +0000 (22:03 +0000)
committerGitHub <noreply@github.com>
Sun, 28 Oct 2018 22:03:18 +0000 (22:03 +0000)
In commit 372d705 a new optimization to the list() type was introduced but it was not added
to the optimization section in What's new for Python 3.8.

Doc/whatsnew/3.8.rst

index 05b7d235cee800016b8457536fd558e5d1b9fb1f..758d32e6e55a438e8543fddbf092a1dbdcb41183 100644 (file)
@@ -242,6 +242,11 @@ Optimizations
   Note that this means that instances can no longer be weak-referenced and
   that arbitrary attributes can no longer be added to them.
 
+* The :class:`list` constructor does not overallocate the internal item buffer
+  if the input iterable has a known length (the input implements ``__len__``).
+  This makes the created list 12% smaller on average. (Contributed by Pablo
+  Galindo in :issue:`33234`.)
+
 
 Build and C API Changes
 =======================