[Patches] [ python-Patches-474532 ] avoid resizes in _PyString_Resize()
noreply@sourceforge.net
noreply@sourceforge.net
Wed, 24 Oct 2001 12:05:06 -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
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2001-10-24 12:05
Message:
Logged In: YES
user_id=31435
Markus, why do you care how ofen realloc is called? More
importantly, why should we <wink>?
This would be more interesting if you had evidence of a
measurable, significant speedup. The test suite runs a lot
of peculiar code, and I've got no reason to believe that
the 15% difference you saw running that is typical, or even
enough to make up for the new costs of the additional
failure tests you added here.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=474532&group_id=5470