[Patches] [ python-Patches-875689 ] >100k alloc wasted on startup
SourceForge.net
noreply at sourceforge.net
Mon Jan 12 16:45:24 EST 2004
Patches item #875689, was opened at 2004-01-12 16:30
Message generated for change (Comment added) made by tim_one
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=875689&group_id=5470
Category: Core (C code)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Mike Pall (mikesfpy)
Assigned to: Nobody/Anonymous (nobody)
>Summary: >100k alloc wasted on startup
Initial Comment:
A glaring error in Objects/intobject.c function _PyInt_Init():
It allocates a whole BLOCK of ints each time through the loop
(i.e. 106 blocks of 1K size) and not just 106 int objects.
Allocating 106 blocks means a preallocation of more than 8600
int objects which is VERY unlikely to be needed by most programs.
So this bug wastes more than 100K on every startup.
The appended patch is vs. the current CVS. The bug is present
in 2.3.* and also in 2.2.? (not sure if I interpret the CVS logs right).
If you don't believe that this bug exists, just add a putc('#',stderr);
right before the code in fill_free_list() and see what happens when
you startup python. :-)
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2004-01-12 16:45
Message:
Logged In: YES
user_id=31435
Good eye! Your analysis is correct, and the patch looks good
too. It's probably bad that the current code is spraying
the "frequently used" little integers all over memory too. The
patch also fixes that.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=875689&group_id=5470
More information about the Patches
mailing list