mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
#1792: Improve performance of marshal.dumps() on large objects by increasing
the size of the buffer more quickly.
This commit is contained in:
parent
ab756f60bd
commit
6c02916dfb
2 changed files with 12 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue