Mercurial > cpython-lru_cache-weakref
diff Python/marshal.c @ 47730:4650eefb5838 legacy-trunk
Issue 3116: fix quadratic behavior in marshal.dumps().
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Mon, 16 Jun 2008 01:42:40 +0000 |
| parents | 52294af4b663 |
| children | 4ebe6b260c55 beaf00c98b71 |
line wrap: on
line diff
--- a/Python/marshal.c Sun Jun 15 19:54:36 2008 +0000 +++ b/Python/marshal.c Mon Jun 16 01:42:40 2008 +0000 @@ -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;
