diff options
author | INADA Naoki <inada-n@klab.com> | 2012-12-06 22:26:39 +0900 |
---|---|---|
committer | INADA Naoki <inada-n@klab.com> | 2012-12-06 22:26:39 +0900 |
commit | 15f309c0b197abe86e94fb3840ff8979b35c7e0c (patch) | |
tree | 6983e230cfc5bec9b27847cd8880fb4bba893635 /README.rst | |
parent | a1577a883876943a3d5b1fe11614e267d2bbd976 (diff) | |
download | msgpack-python-15f309c0b197abe86e94fb3840ff8979b35c7e0c.tar.gz |
Add note about use_list.
Diffstat (limited to 'README.rst')
-rw-r--r-- | README.rst | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -42,6 +42,9 @@ To unpack it to list, Use ``use_list`` option. >>> msgpack.unpackb(b'\x93\x01\x02\x03', use_list=True) [1, 2, 3] +The default behavior will be changed in the future. (probably 0.4) +You should always pass the ``use_list`` keyword argument. + Read the docstring for other options. @@ -151,6 +154,27 @@ or Windows SDK on Windows. (NOTE: Visual C++ Express 2010 doesn't support amd64. Windows SDK is recommanded way to build amd64 msgpack without any fee.) +PERFORMANCE NOTE +----------------- + +GC +^^ + +CPython's GC starts when growing allocated object. +This means unpacking may cause useless GC. +You can use ``gc.disable()`` when unpacking large message. + +use_list +^^^^^^^^^ +List is the default sequence type of Python. +But tuple is lighter than list. +You can use ``use_list=False`` while unpacking when performance is important. + +Python's dict can't use list as key and MessagePack allows array for key of mapping. +``use_list=False`` allows unpacking such message. +Another way to unpacking such object is using ``object_pairs_hook``. + + TEST ---- MessagePack uses `nosetest` for testing. |