[Python-checkins] r64303 - in python/trunk: Misc/NEWS Python/marshal.c
raymond.hettinger
python-checkins at python.org
Mon Jun 16 03:42:40 CEST 2008
Author: raymond.hettinger
Date: Mon Jun 16 03:42:40 2008
New Revision: 64303
Log:
Issue 3116: fix quadratic behavior in marshal.dumps().
Modified:
python/trunk/Misc/NEWS
python/trunk/Python/marshal.c
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Mon Jun 16 03:42:40 2008
@@ -50,6 +50,8 @@
Extension Modules
-----------------
+- Issue #3116: marshal.dumps() had quadratic behavior for strings > 32Mb.
+
- Issue #2138: Add factorial() the math module.
- The heapq module does comparisons using LT instead of LE. This
Modified: python/trunk/Python/marshal.c
==============================================================================
--- python/trunk/Python/marshal.c (original)
+++ python/trunk/Python/marshal.c Mon Jun 16 03:42:40 2008
@@ -67,7 +67,7 @@
size = PyString_Size(p->str);
newsize = size + size + 1024;
if (newsize > 32*1024*1024) {
- newsize = size + 1024*1024;
+ newsize = size + (size >> 3); /* 12.5% overallocation */
}
if (_PyString_Resize(&p->str, newsize) != 0) {
p->ptr = p->end = NULL;
More information about the Python-checkins
mailing list