]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-46235: Do all ref-counting at once during list/tuple multiplication (GH-30346)
authorDennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
Sat, 8 Jan 2022 03:47:58 +0000 (22:47 -0500)
committerGitHub <noreply@github.com>
Sat, 8 Jan 2022 03:47:58 +0000 (21:47 -0600)
commitad1d5908ada171eff768291371a80022bfad4f04
tree040c1e3391995791c8114ea62c911756ad824c68
parent6fa8b2ceee38187b0ae96aee12fe4f0a5c8a2ce7
bpo-46235: Do all ref-counting at once during list/tuple multiplication (GH-30346)

When multiplying lists and tuples by `n`, increment each element's refcount, by `n`, just once.

Saves `n-1` increments per element, and allows for a leaner & faster copying loop.

Code by  sweeneyde (Dennis Sweeney).
Misc/NEWS.d/next/Core and Builtins/2022-01-02-23-55-13.bpo-46235.gUjp2v.rst [new file with mode: 0644]
Objects/listobject.c
Objects/tupleobject.c