Kaydet (Commit) 305480c9 authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Issue 3116: fix quadratic behavior in marshal.dumps().

üst a161f607
...@@ -50,6 +50,8 @@ Core and Builtins ...@@ -50,6 +50,8 @@ Core and Builtins
Extension Modules Extension Modules
----------------- -----------------
- Issue #3116: marshal.dumps() had quadratic behavior for strings > 32Mb.
- Issue #2138: Add factorial() the math module. - Issue #2138: Add factorial() the math module.
- The heapq module does comparisons using LT instead of LE. This - The heapq module does comparisons using LT instead of LE. This
......
...@@ -67,7 +67,7 @@ w_more(int c, WFILE *p) ...@@ -67,7 +67,7 @@ w_more(int c, WFILE *p)
size = PyString_Size(p->str); size = PyString_Size(p->str);
newsize = size + size + 1024; newsize = size + size + 1024;
if (newsize > 32*1024*1024) { if (newsize > 32*1024*1024) {
newsize = size + 1024*1024; newsize = size + (size >> 3); /* 12.5% overallocation */
} }
if (_PyString_Resize(&p->str, newsize) != 0) { if (_PyString_Resize(&p->str, newsize) != 0) {
p->ptr = p->end = NULL; p->ptr = p->end = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment