Skip to main content

MessagePack serializer for chunked data

Project description

Chunked implementation of MessagePack for python.

Description

The library is designed to efficiently pack and unpack large amounts of binary data for data transfer.

This is achieved with an iterative API, which allow to reuse the memory (reducing the memory footprint), and features zero-copy operations (speeding up the transformation).

Benchmark

The main use case is to transfer big binary data together with some metadata. Here is benchmark with few different setups, including the officiel msgpack library as reference.

Here is a log/log diagrams which show GB/s related to the amount of data to process.

Pack

Byterate related to the size of the packed binary

Unpack

Byterate related to the binary size to unpack

Example

Pack

import msgpack_chunk
packer = msgpack_chunk.Packer(
    expose_object_buffer="full",
)

io = ...

packer.pack(python_object)
main_buffer = bytearray(64 * 1024)
while result_buffer := packer.read_into(main_buffer):
    io.write(result_buffer)

Unpack

import msgpack_chunk
unpacker = msgpack_chunk.Unpacker()

io = ...

main_buffer = bytearray(64 * 1024)
while True:
    nb = io.readinto(main_buffer)
    if nb == 0:
        break
    unpacker.feed(main_buffer[:nb])

python_objects = list(unpacker)

Advanced unpack

Allow to write directly inside the final python object, when dealing with big binary or ext type data.

import msgpack_chunk
unpacker = msgpack_chunk.Unpacker(
    bin="bytearray",
    expose_direct_buffer=True,
)

io = ...

main_buffer = bytearray(64 * 1024)
while True:
    direct_buffer = unpacker.get_buffer()
    if direct_buffer is not None and len(direct_buffer) > 16 * 1024:
        nb = io.readinto(direct_buffer)
        if not data:
            break
        unpacker.buffer_updated(nb)
    else:
        nb = io.readinto(main_buffer)
        if nb == 0:
            break
        unpacker.feed(main_buffer[:nb])

python_objects = list(unpacker)

Resources

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

msgpack_chunk-0.1.0.dev0-cp314-cp314t-musllinux_1_2_x86_64.whl (651.3 kB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ x86-64

msgpack_chunk-0.1.0.dev0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl (648.4 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ x86-64manylinux: glibc 2.34+ x86-64

msgpack_chunk-0.1.0.dev0-cp314-cp314-musllinux_1_2_x86_64.whl (632.1 kB view details)

Uploaded CPython 3.14musllinux: musl 1.2+ x86-64

msgpack_chunk-0.1.0.dev0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl (632.1 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64manylinux: glibc 2.34+ x86-64

msgpack_chunk-0.1.0.dev0-cp313-cp313-musllinux_1_2_x86_64.whl (636.0 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

msgpack_chunk-0.1.0.dev0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl (636.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.34+ x86-64

msgpack_chunk-0.1.0.dev0-cp312-cp312-musllinux_1_2_x86_64.whl (760.1 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

msgpack_chunk-0.1.0.dev0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl (648.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.34+ x86-64

msgpack_chunk-0.1.0.dev0-cp311-cp311-musllinux_1_2_x86_64.whl (745.4 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

msgpack_chunk-0.1.0.dev0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl (632.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.34+ x86-64

File details

Details for the file msgpack_chunk-0.1.0.dev0-cp314-cp314t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.1.0.dev0-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 391eb1bb5282ad923f9e41b73870c2935f260d465560d791910bc3066fe5eac2
MD5 9047e7635b8098be6566c625d154a71d
BLAKE2b-256 e402c0c0ea951762231724bfe3653a928a666d02aba00ed7ac3d2925c1a7e061

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.1.0.dev0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.1.0.dev0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 32ea2135374cf8c4c7f721c9b5859dd5e0bdaa1cd5f85016188b8703a31f4062
MD5 629169c8f60b8962778dbfc98f30bdcd
BLAKE2b-256 80367a86318af93795aaf1f975ab272fc5b40d5e3000789eed4611a3b47f0c8d

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.1.0.dev0-cp314-cp314-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.1.0.dev0-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 717afea842cd30949a3e0d8c3d03bbb726fdaa6922a3a71f1d8c4c2e7091fa08
MD5 77add0f7508c96e3e7c79306d9a04572
BLAKE2b-256 5a4c86cc1c92f74808eeec7ed35c0e73a9c9c2faf26c6becadfeba5cde71e6c0

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.1.0.dev0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.1.0.dev0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ed27476cfc7c9d0ac615b06fa9a8c18898a26fb9e6ca69aec5aa2c30ab647172
MD5 7d09a46d018709cdb706445230394545
BLAKE2b-256 3744a4ff8da06a22bd6d28d3bac3160511becfd4eca475abe6c3f426e2b0aa11

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.1.0.dev0-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.1.0.dev0-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e3cd6cd1d43b9fe9f94753304aac8aeed7fcfa0cf67205075a2cbf06cc799383
MD5 f458fe6b1af50f162a656849259ad8b1
BLAKE2b-256 d74c1c8cf9e0d558cb2de449fc4b711e5090b363d935fca2517fbe9a7ee9d87e

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.1.0.dev0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.1.0.dev0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 57eaad7980d55bb0022a7ee2da7b24d625e10b8b7bfc5cb9f4c39958503dcdfe
MD5 dbc90a8c7f75fb4fbbb53f94c5cab99f
BLAKE2b-256 07fc9be50f5950a9090a62e96c1e4cb3d97b1d524d45974606f28514425f8ba6

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.1.0.dev0-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.1.0.dev0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 de169a2ad061f1c675db1b92aa0bf9b4e13c750dbc4eca727e9fc7fbf282752d
MD5 b2d53964998d32879351e1de51ee3cf6
BLAKE2b-256 3d5b4f532611ff4a81929c62f0dd6512569e87e0b5378cd0ed7f4bab2ed2de8c

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.1.0.dev0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.1.0.dev0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 29e28f03c8cf5e13a83dd69eeaece9cc1df1a9944c4e886f2c18bb5ca386760f
MD5 1b60b301e12ae82180f1b0a3cadeee3a
BLAKE2b-256 bb912cbdfbc3fb7c7e61be1ed391ac0818f67de1407fc45c2a28d0bafb0ced2e

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.1.0.dev0-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.1.0.dev0-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 17b0a9d3b824f5acdb2f25d683f23dfd7e7ca791d9a7a8793c52cbfe9d6b8c01
MD5 5037d30ea98a39df7cfa95ce80993cb7
BLAKE2b-256 d1515b8b3b6f307fadea4d5df9b94c1c140f7438f71b4525cd6c14efc0a36fa4

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.1.0.dev0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.1.0.dev0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 c980ad07a1dc9467ae7a5297492e38c50f897d466835f9260540a5db4bf4a478
MD5 24b4e86326740b4b40bba692d77e7ab2
BLAKE2b-256 fab594cd3ec5552f9c571ab2561d57ba6970358025cc03d433de1ded0b4f8169

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page