mirror of
https://github.com/python/cpython.git
synced 2024-11-24 18:34:43 +08:00
SF patch #875689: >100k alloc wasted on startup
(Contributed by Mike Pall.) Make sure fill_free_list() is called only once rather than 106 times when pre-allocating small ints.
This commit is contained in:
parent
4c9800d663
commit
b32e640489
@ -411,6 +411,7 @@ Jason Orendorff
|
||||
Douglas Orr
|
||||
Denis S. Otkidach
|
||||
Russel Owen
|
||||
Mike Pall
|
||||
Todd R. Palmer
|
||||
Alexandre Parenteau
|
||||
Dan Parisien
|
||||
|
@ -1064,7 +1064,7 @@ _PyInt_Init(void)
|
||||
int ival;
|
||||
#if NSMALLNEGINTS + NSMALLPOSINTS > 0
|
||||
for (ival = -NSMALLNEGINTS; ival < NSMALLPOSINTS; ival++) {
|
||||
if ((free_list = fill_free_list()) == NULL)
|
||||
if (!free_list && (free_list = fill_free_list()) == NULL)
|
||||
return 0;
|
||||
/* PyObject_New is inlined */
|
||||
v = free_list;
|
||||
|
Loading…
Reference in New Issue
Block a user