Skip to content
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

Speed up pickling simple non-recusive values #78322

Closed
serhiy-storchaka opened this issue Jul 17, 2018 · 2 comments
Closed

Speed up pickling simple non-recusive values #78322

serhiy-storchaka opened this issue Jul 17, 2018 · 2 comments
Labels
3.8 only security fixes performance Performance or resource usage stdlib Python modules in the Lib dir

Comments

@serhiy-storchaka
Copy link
Member

BPO 34141
Nosy @pitrou, @avassalotti, @serhiy-storchaka
PRs
  • bpo-34141: Optimized pickling simple non-recursive values. #8318
  • 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 = <Date 2018-07-18.07:20:57.114>
    created_at = <Date 2018-07-17.16:49:06.639>
    labels = ['3.8', 'library', 'performance']
    title = 'Speed up pickling simple non-recusive values'
    updated_at = <Date 2018-07-18.07:20:57.113>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2018-07-18.07:20:57.113>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-07-18.07:20:57.114>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2018-07-17.16:49:06.639>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 34141
    keywords = ['patch']
    message_count = 2.0
    messages = ['321841', '321862']
    nosy_count = 3.0
    nosy_names = ['pitrou', 'alexandre.vassalotti', 'serhiy.storchaka']
    pr_nums = ['8318']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue34141'
    versions = ['Python 3.8']

    @serhiy-storchaka
    Copy link
    Member Author

    The proposed PR reduces an overhead of calling Py_EnterRecursiveCall() when pickle simple non-recusive values: None, True, False, instances of int, float, bytes, str.

    $ ./python -m timeit -s 'data = list(range(10**7)); import pickle' -- 'pickle.dumps(data)'

    Unpatched: 218 msec per loop
    Patched: 147 msec per loop

    $ ./python -m timeit -s 'data = list(map(float, range(10**7))); import pickle' -- 'pickle.dumps(data)'

    Unpatched: 218 msec per loop
    Patched: 179 msec per loop

    $ ./python -m timeit -s 'data = list(map(str, range(10**6))); import pickle' -- 'pickle.dumps(data)'

    Unpatched: 212 msec per loop
    Patched: 201 msec per loop

    @serhiy-storchaka serhiy-storchaka added 3.8 only security fixes stdlib Python modules in the Lib dir performance Performance or resource usage labels Jul 17, 2018
    @serhiy-storchaka
    Copy link
    Member Author

    New changeset 5d4cb54 by Serhiy Storchaka in branch 'master':
    bpo-34141: Optimized pickling simple non-recursive values. (GH-8318)
    5d4cb54

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 only security fixes performance Performance or resource usage stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant