Skip to content

C implementation of parts of copy.deepcopy #72793

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
villemoes mannequin opened this issue Nov 3, 2016 · 4 comments · May be fixed by #91610
Open

C implementation of parts of copy.deepcopy #72793

villemoes mannequin opened this issue Nov 3, 2016 · 4 comments · May be fixed by #91610
Labels
3.12 only security fixes extension-modules C modules in the Modules dir performance Performance or resource usage

Comments

@villemoes
Copy link
Mannequin

villemoes mannequin commented Nov 3, 2016

BPO 28607
Nosy @Villemoes, @pablogsal
Files
  • deepcopy.patch
  • deepcopy.patch: patch v2
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2016-11-03.23:11:36.119>
    labels = ['extension-modules', '3.7', 'performance']
    title = 'C implementation of parts of copy.deepcopy'
    updated_at = <Date 2019-01-20.21:43:41.055>
    user = 'https://github.com/villemoes'

    bugs.python.org fields:

    activity = <Date 2019-01-20.21:43:41.055>
    actor = 'pablogsal'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Extension Modules']
    creation = <Date 2016-11-03.23:11:36.119>
    creator = 'villemoes'
    dependencies = []
    files = ['45344', '45400']
    hgrepos = []
    issue_num = 28607
    keywords = ['patch']
    message_count = 3.0
    messages = ['280032', '280360', '334105']
    nosy_count = 2.0
    nosy_names = ['villemoes', 'pablogsal']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'test needed'
    status = 'open'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue28607'
    versions = ['Python 3.7']

    @villemoes
    Copy link
    Mannequin Author

    villemoes mannequin commented Nov 3, 2016

    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.

    @villemoes villemoes mannequin added stdlib Python modules in the Lib dir 3.7 (EOL) end of life performance Performance or resource usage labels Nov 3, 2016
    @brettcannon brettcannon added extension-modules C modules in the Modules dir and removed stdlib Python modules in the Lib dir labels Nov 3, 2016
    @villemoes
    Copy link
    Mannequin Author

    villemoes mannequin commented Nov 8, 2016

    New version, addressing (hopefully) all review comments.

    @pablogsal
    Copy link
    Member

    Hy Rasmus,

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

    Thanks!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @peendebak
    Copy link
    Contributor

    @pablogsal The issue has been stale for a long time, but I created a PR and provided benchmarks.

    The functionality of deepcopy has not changed, so I am not sure whether more tests are required. If so, can you let me know which specific tests you had in mind?

    @iritkatriel iritkatriel added 3.12 only security fixes and removed 3.7 (EOL) end of life labels Sep 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.12 only security fixes extension-modules C modules in the Modules dir performance Performance or resource usage
    Projects
    Status: No status
    Development

    Successfully merging a pull request may close this issue.

    4 participants