]> granicus.if.org Git - python/commitdiff
SF patch #875689: >100k alloc wasted on startup
authorRaymond Hettinger <python@rcn.com>
Sun, 8 Feb 2004 18:54:37 +0000 (18:54 +0000)
committerRaymond Hettinger <python@rcn.com>
Sun, 8 Feb 2004 18:54:37 +0000 (18:54 +0000)
(Contributed by Mike Pall.)

Make sure fill_free_list() is called only once rather than 106 times
when pre-allocating small ints.

Misc/ACKS
Objects/intobject.c

index 77c798074bc7d4622716aa340284b3ffbe80653e..61b07cba53ee713902c6e65c87d63afb0b1e2ba4 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -411,6 +411,7 @@ Jason Orendorff
 Douglas Orr
 Denis S. Otkidach
 Russel Owen
+Mike Pall
 Todd R. Palmer
 Alexandre Parenteau
 Dan Parisien
index 47acbff96d3803783e7fbc6dbc06d690efe4fb06..18624b31ef1d7044a4ad2dcbec6a0054d7e1b3fd 100644 (file)
@@ -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;