Commit 87758ec
committed
perf(longobject): add freelist for 2-digit PyLong objects
Non-compact (2-digit) int results previously bypassed the freelist and called PyObject_Malloc directly. Add an `ints2` freelist alongside the existing `ints` (1-digit) freelist.
- `long_alloc(2)` checks `ints2` before `PyObject_Malloc`
- `_PyLong_ExactDealloc` and `long_dealloc` recycle exact 2-digit ints to `ints2` instead of immediately freeing them
- `_PyObject_ClearFreeLists` clears `ints2` the same way as `ints`1 parent 5b69f64 commit 87758ec
3 files changed
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| 51 | + | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
175 | 178 | | |
176 | 179 | | |
177 | 180 | | |
| |||
3644 | 3647 | | |
3645 | 3648 | | |
3646 | 3649 | | |
| 3650 | + | |
| 3651 | + | |
| 3652 | + | |
| 3653 | + | |
3647 | 3654 | | |
3648 | 3655 | | |
3649 | 3656 | | |
| |||
3664 | 3671 | | |
3665 | 3672 | | |
3666 | 3673 | | |
| 3674 | + | |
| 3675 | + | |
| 3676 | + | |
| 3677 | + | |
3667 | 3678 | | |
3668 | 3679 | | |
3669 | 3680 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
952 | 952 | | |
953 | 953 | | |
954 | 954 | | |
| 955 | + | |
955 | 956 | | |
956 | 957 | | |
957 | 958 | | |
| |||
0 commit comments