a shorter serializer
Project description
shorser
Shorter serializer. Helpful if you are using sqlitedict
/ filecache
to store key value pairs.
Usage
To use shorser with std json backend:
from shorser import jdump, jload
bytes_buf = jdump(obj)
obj = jload(bytes_buf)
Compare with JSON
Value | JSON (utf-8 encoded) | shorser (with JSON backend) | Saved bytes |
---|---|---|---|
None |
b'null' |
None |
4 |
True |
b'true' |
b'y' |
3 |
False |
b'false' |
b'n' |
3 |
100 |
b'100' |
b'id' (store integer in little order bytes, with prefix i ) |
a lot |
'vnais' |
b'"vnais"' |
b'svnais' |
1 |
b'dsads15' |
Not Support | b'bdsads15' |
|
{'a': 10} |
b'{"a": 10}' |
b'u{"a": 10}' |
-1 |
- shorser is support
bytes
type; - integer type is unreadable;
- in most cases, shorser is smaller than backend (like JSON);
- in most cases, shorser is faster than backend (like JSON);
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
shorser-0.1.1.tar.gz
(3.3 kB
view hashes)