summaryrefslogtreecommitdiffstats
path: root/Python/marshal.c
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2008-05-11 13:33:56 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2008-05-11 13:33:56 (GMT)
commit6c02916dfbdad27f26888c287d2cfa5639667731 (patch)
tree153688377587615ef56c0c086bd73fa403331c3d /Python/marshal.c
parentab756f60bdef88f15cc94c77e0752c6c7c8d708f (diff)
downloadcpython-6c02916dfbdad27f26888c287d2cfa5639667731.zip
cpython-6c02916dfbdad27f26888c287d2cfa5639667731.tar.gz
cpython-6c02916dfbdad27f26888c287d2cfa5639667731.tar.bz2
#1792: Improve performance of marshal.dumps() on large objects by increasing
the size of the buffer more quickly.
Diffstat (limited to 'Python/marshal.c')
-rw-r--r--Python/marshal.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/marshal.c b/Python/marshal.c
index 6ca3495..6db46e4 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -65,7 +65,10 @@ w_more(int c, WFILE *p)
if (p->str == NULL)
return; /* An error already occurred */
size = PyString_Size(p->str);
- newsize = size + 1024;
+ newsize = size + size + 1024;
+ if (newsize > 32*1024*1024) {
+ newsize = size + 1024*1024;
+ }
if (_PyString_Resize(&p->str, newsize) != 0) {
p->ptr = p->end = NULL;
}