Skip to main content

an efficient binary serialization format for numerical data

Project description

NumBin

PyPI version Python Version License Check status

An efficient binary serialization format for numerical data.

Install

pip install numbin

Usage

from numbin import NumBin
import numpy as np

nb = NumBin()
arr = np.random.rand(5, 3)

# in memory
binary = nb.dumps(arr)
print(nb.loads(binary))

# file
with open("num.bin", "wb") as f:
    nb.dump(arr, f)

with open("num.bin", "rb") as f:
    print(nb.load(f))

Benchmark

The code can be found in bench.py

Tested with AMD Ryzen 7 5800H.

================================================================================
pickle_serde
size:            1      times: min(8.065e-06)   mid(8.457e-06)  max(0.00014736) 95%(8.185e-06)  Std.(3.1934e-06)
size:         1024      times: min(9.428e-06)   mid(1.015e-05)  max(0.00014235) 95%(9.638e-06)  Std.(3.8205e-06)
size:        65536      times: min(0.000155)    mid(0.0001581)  max(0.00061054) 95%(0.00015533) Std.(2.3462e-05)
size:      3145728      times: min(0.0072165)   mid(0.0082978)  max(0.015297)   95%(0.0073169)  Std.(0.001018)
size:    201326592      times: min(1.1303)      mid(1.23)       max(1.3989)     95%(1.1323)     Std.(0.089972)
================================================================================
numbin_serde
size:            1      times: min(1.974e-06)   mid(2.084e-06)  max(0.00019909) 95%(2.013e-06)  Std.(2.1158e-06)
size:         1024      times: min(2.514e-06)   mid(2.685e-06)  max(9.9267e-05) 95%(2.574e-06)  Std.(1.7772e-06)
size:        65536      times: min(2.3535e-05)  mid(2.4196e-05) max(0.00051521) 95%(2.3595e-05) Std.(1.586e-05)
size:      3145728      times: min(0.0068677)   mid(0.0075904)  max(0.020155)   95%(0.0069143)  Std.(0.0013657)
size:    201326592      times: min(0.51976)     mid(0.66418)    max(0.74812)    95%(0.52107)    Std.(0.083191)
================================================================================
numpy_save_load
size:            1      times: min(0.00010345)  mid(0.00011227) max(0.0096088)  95%(0.00010525) Std.(0.00010952)
size:         1024      times: min(0.00010638)  mid(0.00011138) max(0.00039846) 95%(0.00010751) Std.(2.5658e-05)
size:        65536      times: min(0.00016052)  mid(0.00016934) max(0.00057942) 95%(0.00016236) Std.(2.4938e-05)
size:      3145728      times: min(0.01337)     mid(0.017721)   max(0.023641)   95%(0.013613)   Std.(0.0024529)
size:    201326592      times: min(1.5571)      mid(2.5337)     max(5.0581)     95%(1.5796)     Std.(1.1949)

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

numbin-0.3.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

numbin-0.3.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file numbin-0.3.0.tar.gz.

File metadata

  • Download URL: numbin-0.3.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for numbin-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f112e38e5fd4d0b8c9bd03cefbd2a70475234dab1e952509a3474127107a4aac
MD5 65098380e97abff9e8060c3ee65e375b
BLAKE2b-256 3a276cddc3f60b789256d348277d74dcd30d5056f34e454283ede3c34a93ea62

See more details on using hashes here.

File details

Details for the file numbin-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: numbin-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for numbin-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 820b050faa84a0ae3be92182e6aeca4b5250be6e3a0a4c21c039a15005945d53
MD5 243580d1f2ef4e663170f9d613b9430d
BLAKE2b-256 5bc1b55d84347f1873c2aaf601c4ad879bfe9f6056612fc86549fc74cc740ab3

See more details on using hashes here.

Supported by

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