[New-bugs-announce] [issue34141] Speed up pickling simple non-recusive values

Serhiy Storchaka report at bugs.python.org
Tue Jul 17 12:49:06 EDT 2018


New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:

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

----------
components: Library (Lib)
messages: 321841
nosy: alexandre.vassalotti, pitrou, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Speed up pickling simple non-recusive values
type: performance
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34141>
_______________________________________


More information about the New-bugs-announce mailing list