Skip to content

Commit fdf5c1c

Browse files
committed
change default buffer size to 256KiB
1 parent db39717 commit fdf5c1c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

msgpack/_packer.pyx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ cdef class Packer(object):
105105
DO NOT USE THIS!! This option is kept for very specific usage.
106106
107107
:param int buf_size:
108-
The size of the internal buffer. (default: 1024 * 1024)
108+
The size of the internal buffer. (default: 256*1024)
109109
Useful if serialisation size can be correctly estimated,
110110
avoid unnecessary reallocations.
111111
"""
@@ -118,7 +118,7 @@ cdef class Packer(object):
118118
cdef bint autoreset
119119
cdef bint datetime
120120

121-
def __cinit__(self, buf_size=1024*1024, **_kwargs):
121+
def __cinit__(self, buf_size=256*1024, **_kwargs):
122122
self.pk.buf = <char*> PyMem_Malloc(buf_size)
123123
if self.pk.buf == NULL:
124124
raise MemoryError("Unable to allocate internal buffer.")
@@ -127,7 +127,8 @@ cdef class Packer(object):
127127

128128
def __init__(self, *, default=None,
129129
bint use_single_float=False, bint autoreset=True, bint use_bin_type=True,
130-
bint strict_types=False, bint datetime=False, unicode_errors=None, buf_size=1024*1024):
130+
bint strict_types=False, bint datetime=False, unicode_errors=None,
131+
buf_size=256*1024):
131132
self.use_float = use_single_float
132133
self.strict_types = strict_types
133134
self.autoreset = autoreset

0 commit comments

Comments
 (0)