diff options
author | Victor Stinner <vstinner@python.org> | 2020-06-04 23:14:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-04 23:14:40 (GMT) |
commit | 7daba6f221e713f7f60c613b246459b07d179f91 (patch) | |
tree | 54d09c4a586483468666fc635dee8152e5d8e102 /Include | |
parent | 2ba59370c3dda2ac229c14510e53a05074b133d1 (diff) | |
download | cpython-7daba6f221e713f7f60c613b246459b07d179f91.zip cpython-7daba6f221e713f7f60c613b246459b07d179f91.tar.gz cpython-7daba6f221e713f7f60c613b246459b07d179f91.tar.bz2 |
bpo-40521: Make slice cache per-interpreter (GH-20637)
Each interpreter now has its own slice cache:
* Move slice cache into PyInterpreterState.
* Add tstate parameter to _PySlice_Fini().
Diffstat (limited to 'Include')
-rw-r--r-- | Include/internal/pycore_interp.h | 4 | ||||
-rw-r--r-- | Include/internal/pycore_pylifecycle.h | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h index c0eed00..70054ef 100644 --- a/Include/internal/pycore_interp.h +++ b/Include/internal/pycore_interp.h @@ -187,6 +187,10 @@ struct _is { #endif struct _Py_tuple_state tuple; struct _Py_float_state float_state; + + /* Using a cache is very effective since typically only a single slice is + created and then deleted again. */ + PySliceObject *slice_cache; }; /* Used by _PyImport_Cleanup() */ diff --git a/Include/internal/pycore_pylifecycle.h b/Include/internal/pycore_pylifecycle.h index 2643abc..bba9bd9 100644 --- a/Include/internal/pycore_pylifecycle.h +++ b/Include/internal/pycore_pylifecycle.h @@ -65,7 +65,7 @@ extern void _PyList_Fini(void); extern void _PySet_Fini(void); extern void _PyBytes_Fini(void); extern void _PyFloat_Fini(PyThreadState *tstate); -extern void _PySlice_Fini(void); +extern void _PySlice_Fini(PyThreadState *tstate); extern void _PyAsyncGen_Fini(void); extern void PyOS_FiniInterrupts(void); |