This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: C implementation of parts of copy.deepcopy
Type: performance Stage: test needed
Components: Extension Modules Versions: Python 3.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: pablogsal, villemoes
Priority: normal Keywords: patch

Created on 2016-11-03 23:11 by villemoes, last changed 2022-04-11 14:58 by admin.

File name Uploaded Description Edit
deepcopy.patch villemoes, 2016-11-03 23:11 review
deepcopy.patch villemoes, 2016-11-08 23:12 patch v2 review
Messages (3)
msg280032 - (view) Author: Rasmus Villemoes (villemoes) Date: 2016-11-03 23:11
This is mostly an RFC patch. It compiles and passes the test suite. A somewhat silly microbenchmark such as

./python -m timeit -s 'import copy; x = dict([(str(x), x) for x in range(10000)]);'  'copy.deepcopy(x)'

runs about 30x faster. In the (2.7 only) application which motivated this, the part of its initialization that does a lot of deepcopying drops from 11s to 3s. That it's so much less is presumably because the application holds on to the deepcopies, so there's much more allocation going on than in the microbenchmark, but I haven't investigated thoroughly. In any case, a 3.5x speedup is also nice.
msg280360 - (view) Author: Rasmus Villemoes (villemoes) Date: 2016-11-08 23:12
New version, addressing (hopefully) all review comments.
msg334105 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2019-01-20 21:43
Hy Rasmus,

would you like to make a PR with your patch and adding some tests?

Date User Action Args
2022-04-11 14:58:39adminsetgithub: 72793
2019-01-20 21:43:41pablogsalsetnosy: + pablogsal
messages: + msg334105
2016-11-08 23:12:38villemoessetfiles: + deepcopy.patch

messages: + msg280360
2016-11-03 23:13:58brett.cannonsetcomponents: + Extension Modules, - Library (Lib)
stage: test needed
2016-11-03 23:11:36villemoescreate