classification
Title: Speed up pickling simple non-recusive values
Type: performance Stage: resolved
Components: Library (Lib) Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: alexandre.vassalotti, pitrou, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2018-07-17 16:49 by serhiy.storchaka, last changed 2018-07-18 07:20 by serhiy.storchaka. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 8318 merged serhiy.storchaka, 2018-07-17 16:50
Messages (2)
msg321841 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-07-17 16:49
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
msg321862 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-07-18 07:10
New changeset 5d4cb54800966947db2e86f65fb109c5067076be by Serhiy Storchaka in branch 'master':
bpo-34141: Optimized pickling simple non-recursive values. (GH-8318)
https://github.com/python/cpython/commit/5d4cb54800966947db2e86f65fb109c5067076be
History
Date User Action Args
2018-07-18 07:20:57serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-07-18 07:10:55serhiy.storchakasetmessages: + msg321862
2018-07-17 16:50:30serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request7853
2018-07-17 16:49:06serhiy.storchakacreate