mirror of https://github.com/python/cpython
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
|
Douglas Orr
|
||||||
Denis S. Otkidach
|
Denis S. Otkidach
|
||||||
Russel Owen
|
Russel Owen
|
||||||
|
Mike Pall
|
||||||
Todd R. Palmer
|
Todd R. Palmer
|
||||||
Alexandre Parenteau
|
Alexandre Parenteau
|
||||||
Dan Parisien
|
Dan Parisien
|
||||||
|
|
|
@ -1064,7 +1064,7 @@ _PyInt_Init(void)
|
||||||
int ival;
|
int ival;
|
||||||
#if NSMALLNEGINTS + NSMALLPOSINTS > 0
|
#if NSMALLNEGINTS + NSMALLPOSINTS > 0
|
||||||
for (ival = -NSMALLNEGINTS; ival < NSMALLPOSINTS; ival++) {
|
for (ival = -NSMALLNEGINTS; ival < NSMALLPOSINTS; ival++) {
|
||||||
if ((free_list = fill_free_list()) == NULL)
|
if (!free_list && (free_list = fill_free_list()) == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
/* PyObject_New is inlined */
|
/* PyObject_New is inlined */
|
||||||
v = free_list;
|
v = free_list;
|
||||||
|
|
Loading…
Reference in New Issue