[Patches] [ python-Patches-474532 ] avoid resizes in _PyString_Resize()

noreply@sourceforge.net noreply@sourceforge.net
Wed, 24 Oct 2001 09:44:23 -0700


Patches item #474532, was opened at 2001-10-24 09:44
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=474532&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Markus F.X.J. Oberhumer (mfx)
Assigned to: Nobody/Anonymous (nobody)
Summary: avoid resizes in _PyString_Resize()

Initial Comment:
The patch below (against CVS 2001-10-24) avoids
unnecessary calls to PyObject_REALLOC in
_PyString_Resize if the size of the string does 
not change.

When running the regression test with this patch on
my Linux machine it shows that 53339 out of 323003
resizes can be avoided - this is more than 15%.

Additionally I've added sanity checks in
_PyStringResize to test for virgin values
of ob_shash and ob_sinterned. Better safe
than sorry.

Markus

--- Markus.F.X.J. Oberhumer <markus@oberhumer.com>
--- author of PySol


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=474532&group_id=5470