Skip to main content

High-performance JSON/NDJSON compression library

Project description

jzpack

High-compression JSON library using columnar storage + zstd.

Installation

pip install jzpack

Quick Start

from jzpack import compress, decompress

data = [{"service": "api", "status": "ok", "latency": 42} for _ in range(10000)]

compressed = compress(data)
original = decompress(compressed)

Benchmarks

100K records, zstd level 3, 3 iterations averaged.

Realistic Data (mixed repetition):

Strategy Size Ratio Compress Decompress
json + gzip 5.71 MB 3.45x 14 MB/s 91 MB/s
orjson + zstd 5.86 MB 3.36x 220 MB/s 143 MB/s
msgpack + zstd 5.71 MB 3.44x 154 MB/s 125 MB/s
jzpack 4.60 MB 4.28x 48 MB/s 53 MB/s

High Cardinality (worst case, unique values):

Strategy Size Ratio Compress Decompress
json + gzip 19.94 MB 1.78x 14 MB/s 102 MB/s
orjson + zstd 19.61 MB 1.81x 159 MB/s 166 MB/s
msgpack + zstd 19.04 MB 1.87x 147 MB/s 175 MB/s
jzpack 15.86 MB 2.24x 75 MB/s 79 MB/s

vs msgpack+zstd (same underlying compression): 17-19% smaller, 2-3x slower.

Run: python benchmark.py

When to Use

Cold storage, archival, network transfer
Datasets with field repetition

API

from jzpack import compress, decompress, JZPackCompressor, StreamingCompressor

compress(data, level=3) -> bytes
decompress(data) -> list[dict]

compressor = JZPackCompressor(compression_level=3)
compressor.compress(data) -> bytes
compressor.decompress(data) -> list[dict]
compressor.compress_to_file(data, "out.jzpk")
compressor.decompress_from_file("out.jzpk") -> list[dict]

stream = StreamingCompressor(compression_level=3)
stream.add_record(record)
stream.add_batch(records)
stream.finalize() -> bytes
stream.clear()

How It Works

  1. Schema grouping — records grouped by structure
  2. Columnar storage — fields stored as columns
  3. Smart encoding — RLE, Delta, Dictionary per column
  4. MessagePack + Zstandard — binary serialization + compression

License

MIT

Project details


Download files

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

Source Distribution

jzpack-0.1.2.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

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

jzpack-0.1.2-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file jzpack-0.1.2.tar.gz.

File metadata

  • Download URL: jzpack-0.1.2.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jzpack-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a18ce4abff13fba2d8b4bb3332b23aea4afc8510c906d789c597703ee2e13c05
MD5 dd514abb5f8ee88d4ead0743fbe525be
BLAKE2b-256 56a4963ecb6981758305402fe3cbfa106fb1a21b09d76adb28e964de0b48a260

See more details on using hashes here.

Provenance

The following attestation bundles were made for jzpack-0.1.2.tar.gz:

Publisher: python-publish.yml on hasanzaibak/jzpack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jzpack-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: jzpack-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jzpack-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3ed9f13a874150066ecdc6155b05895c3bb03918df41d664fe31da43dd4f55f9
MD5 53ef25b11b77882f73083ba0d92ed79b
BLAKE2b-256 3a6e413c6484211b1372148a76602f145a8ec6c214cf9143c8f04060bc3295c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for jzpack-0.1.2-py3-none-any.whl:

Publisher: python-publish.yml on hasanzaibak/jzpack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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