Mercurial > cpython-lru_cache-weakref
diff Python/marshal.c @ 46880:4fb6c0c169ff legacy-trunk
#1792: Improve performance of marshal.dumps() on large objects by increasing
the size of the buffer more quickly.
| author | Andrew M. Kuchling <amk@amk.ca> |
|---|---|
| date | Sun, 11 May 2008 13:33:56 +0000 |
| parents | 3164b4ae27c3 |
| children | 4fe192d48960 |
line wrap: on
line diff
--- a/Python/marshal.c Sun May 11 11:09:35 2008 +0000 +++ b/Python/marshal.c Sun May 11 13:33:56 2008 +0000 @@ -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; }
