summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-02-08 18:54:37 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-02-08 18:54:37 (GMT)
commitb32e640489f179f956437811497b19d2fa3c33f1 (patch)
tree84ca95edc0dcd53b8a03b0fcfa027ba9b858c97f /Objects
parent4c9800d6634b5dec6a3b20ffb24db8d5fda859ac (diff)
downloadcpython-b32e640489f179f956437811497b19d2fa3c33f1.zip
cpython-b32e640489f179f956437811497b19d2fa3c33f1.tar.gz
cpython-b32e640489f179f956437811497b19d2fa3c33f1.tar.bz2
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.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/intobject.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/intobject.c b/Objects/intobject.c
index 47acbff..18624b3 100644
--- a/Objects/intobject.c
+++ b/Objects/intobject.c
@@ -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;