#1792: Improve performance of marshal.dumps() on large objects by increasing
the size of the buffer more quickly.
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 @@
 	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;
 	}