Skip to content

Commit 15f309c

Browse files
committed
Add note about use_list.
1 parent a1577a8 commit 15f309c

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ To unpack it to list, Use ``use_list`` option.
4242
>>> msgpack.unpackb(b'\x93\x01\x02\x03', use_list=True)
4343
[1, 2, 3]
4444

45+
The default behavior will be changed in the future. (probably 0.4)
46+
You should always pass the ``use_list`` keyword argument.
47+
4548
Read the docstring for other options.
4649

4750

@@ -151,6 +154,27 @@ or Windows SDK on Windows. (NOTE: Visual C++ Express 2010 doesn't support
151154
amd64. Windows SDK is recommanded way to build amd64 msgpack without any fee.)
152155

153156

157+
PERFORMANCE NOTE
158+
-----------------
159+
160+
GC
161+
^^
162+
163+
CPython's GC starts when growing allocated object.
164+
This means unpacking may cause useless GC.
165+
You can use ``gc.disable()`` when unpacking large message.
166+
167+
use_list
168+
^^^^^^^^^
169+
List is the default sequence type of Python.
170+
But tuple is lighter than list.
171+
You can use ``use_list=False`` while unpacking when performance is important.
172+
173+
Python's dict can't use list as key and MessagePack allows array for key of mapping.
174+
``use_list=False`` allows unpacking such message.
175+
Another way to unpacking such object is using ``object_pairs_hook``.
176+
177+
154178
TEST
155179
----
156180
MessagePack uses `nosetest` for testing.

0 commit comments

Comments
 (0)