mirror of
https://github.com/python/cpython.git
synced 2025-10-28 09:10:36 +00:00
gh-111968: Use per-thread slice_cache in free-threading (gh-113972)
This commit is contained in:
parent
44e47dfba5
commit
3eae76554b
7 changed files with 28 additions and 18 deletions
|
|
@ -59,10 +59,19 @@ struct _Py_float_state {
|
|||
#endif
|
||||
};
|
||||
|
||||
struct _Py_slice_state {
|
||||
#ifdef WITH_FREELISTS
|
||||
/* Using a cache is very effective since typically only a single slice is
|
||||
created and then deleted again. */
|
||||
PySliceObject *slice_cache;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct _Py_freelist_state {
|
||||
struct _Py_float_state float_state;
|
||||
struct _Py_tuple_state tuple_state;
|
||||
struct _Py_list_state list_state;
|
||||
struct _Py_slice_state slice_state;
|
||||
} _PyFreeListState;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -249,6 +249,7 @@ extern void _Py_ClearFreeLists(_PyFreeListState *state, int is_finalization);
|
|||
extern void _PyTuple_ClearFreeList(_PyFreeListState *state, int is_finalization);
|
||||
extern void _PyFloat_ClearFreeList(_PyFreeListState *state, int is_finalization);
|
||||
extern void _PyList_ClearFreeList(_PyFreeListState *state, int is_finalization);
|
||||
extern void _PySlice_ClearCache(_PyFreeListState *state);
|
||||
extern void _PyDict_ClearFreeList(PyInterpreterState *interp);
|
||||
extern void _PyAsyncGen_ClearFreeLists(PyInterpreterState *interp);
|
||||
extern void _PyContext_ClearFreeList(PyInterpreterState *interp);
|
||||
|
|
|
|||
|
|
@ -187,9 +187,6 @@ struct _is {
|
|||
struct _Py_long_state long_state;
|
||||
struct _dtoa_state dtoa;
|
||||
struct _py_func_state func_state;
|
||||
/* Using a cache is very effective since typically only a single slice is
|
||||
created and then deleted again. */
|
||||
PySliceObject *slice_cache;
|
||||
|
||||
struct _Py_tuple_state tuple;
|
||||
struct _Py_dict_state dict_state;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ extern "C" {
|
|||
|
||||
/* runtime lifecycle */
|
||||
|
||||
extern void _PySlice_Fini(PyInterpreterState *);
|
||||
extern void _PySlice_Fini(_PyFreeListState *);
|
||||
|
||||
extern PyObject *
|
||||
_PyBuildSlice_ConsumeRefs(PyObject *start, PyObject *stop);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue