Skip to content

Commit d361dc9

Browse files
committed
cleanup: drop ints2/ints3 freelists and benchmark script
1 parent 24a31a1 commit d361dc9

4 files changed

Lines changed: 3 additions & 116 deletions

File tree

Include/internal/pycore_freelist_state.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ extern "C" {
1818
# define Py_floats_MAXFREELIST 100
1919
# define Py_complexes_MAXFREELIST 100
2020
# define Py_ints_MAXFREELIST 100
21-
# define Py_ints2_MAXFREELIST 100
22-
# define Py_ints3_MAXFREELIST 50
2321
# define Py_slices_MAXFREELIST 1
2422
# define Py_ranges_MAXFREELIST 6
2523
# define Py_range_iters_MAXFREELIST 6
@@ -49,8 +47,6 @@ struct _Py_freelists {
4947
struct _Py_freelist floats;
5048
struct _Py_freelist complexes;
5149
struct _Py_freelist ints;
52-
struct _Py_freelist ints2;
53-
struct _Py_freelist ints3;
5450
struct _Py_freelist tuples[PyTuple_MAXSAVESIZE];
5551
struct _Py_freelist lists;
5652
struct _Py_freelist list_iters;

Objects/longobject.c

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,6 @@ long_alloc(Py_ssize_t size)
172172
if (ndigits == 1) {
173173
result = (PyLongObject *)_Py_FREELIST_POP(PyLongObject, ints);
174174
}
175-
else if (ndigits == 2) {
176-
result = (PyLongObject *)_Py_FREELIST_POP(PyLongObject, ints2);
177-
}
178-
else if (ndigits == 3) {
179-
result = (PyLongObject *)_Py_FREELIST_POP(PyLongObject, ints3);
180-
}
181175
if (result == NULL) {
182176
/* Number of bytes needed is: offsetof(PyLongObject, ob_digit) +
183177
sizeof(digit)*size. Previous incarnations of this code used
@@ -3650,15 +3644,6 @@ _PyLong_ExactDealloc(PyObject *self)
36503644
_Py_FREELIST_FREE(ints, self, PyObject_Free);
36513645
return;
36523646
}
3653-
Py_ssize_t ndigits = _PyLong_DigitCount((PyLongObject *)self);
3654-
if (ndigits == 2) {
3655-
_Py_FREELIST_FREE(ints2, self, PyObject_Free);
3656-
return;
3657-
}
3658-
if (ndigits == 3) {
3659-
_Py_FREELIST_FREE(ints3, self, PyObject_Free);
3660-
return;
3661-
}
36623647
PyObject_Free(self);
36633648
}
36643649

@@ -3675,20 +3660,9 @@ long_dealloc(PyObject *self)
36753660
_Py_SetImmortal(self);
36763661
return;
36773662
}
3678-
if (PyLong_CheckExact(self)) {
3679-
if (_PyLong_IsCompact((PyLongObject *)self)) {
3680-
_Py_FREELIST_FREE(ints, self, PyObject_Free);
3681-
return;
3682-
}
3683-
Py_ssize_t ndigits = _PyLong_DigitCount((PyLongObject *)self);
3684-
if (ndigits == 2) {
3685-
_Py_FREELIST_FREE(ints2, self, PyObject_Free);
3686-
return;
3687-
}
3688-
if (ndigits == 3) {
3689-
_Py_FREELIST_FREE(ints3, self, PyObject_Free);
3690-
return;
3691-
}
3663+
if (PyLong_CheckExact(self) && _PyLong_IsCompact((PyLongObject *)self)) {
3664+
_Py_FREELIST_FREE(ints, self, PyObject_Free);
3665+
return;
36923666
}
36933667
Py_TYPE(self)->tp_free(self);
36943668
}

Objects/object.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -952,8 +952,6 @@ _PyObject_ClearFreeLists(struct _Py_freelists *freelists, int is_finalization)
952952
clear_freelist(&freelists->unicode_writers, is_finalization, PyMem_Free);
953953
clear_freelist(&freelists->bytes_writers, is_finalization, PyMem_Free);
954954
clear_freelist(&freelists->ints, is_finalization, free_object);
955-
clear_freelist(&freelists->ints2, is_finalization, free_object);
956-
clear_freelist(&freelists->ints3, is_finalization, free_object);
957955
clear_freelist(&freelists->pycfunctionobject, is_finalization, PyObject_GC_Del);
958956
clear_freelist(&freelists->pycmethodobject, is_finalization, PyObject_GC_Del);
959957
clear_freelist(&freelists->pymethodobjects, is_finalization, free_object);

Tools/scripts/bench_wide_int_pyperf.py

Lines changed: 0 additions & 81 deletions
This file was deleted.

0 commit comments

Comments
 (0)