gh-148072: Cache pickle.dumps/loads per interpreter in XIData · jrfk/cpython@c39755e · GitHub
Skip to content

Commit c39755e

Browse files
committed
pythongh-148072: Cache pickle.dumps/loads per interpreter in XIData
Store references to pickle.dumps and pickle.loads in _PyXI_state_t so they are looked up only once per interpreter lifetime, avoiding repeated PyImport_ImportModuleAttrString calls on every cross-interpreter data transfer via pickle fallback. Benchmarks show 1.7x-3.3x speedup for InterpreterPoolExecutor when transferring mutable types (list, dict) through XIData.
1 parent 7e275d4 commit c39755e

2 files changed

Lines changed: 53 additions & 6 deletions

File tree

Include/internal/pycore_crossinterp.h

Lines changed: 6 additions & 0 deletions

Python/crossinterp.c

Lines changed: 47 additions & 6 deletions

0 commit comments

Comments
 (0)