Pot
A concise storage format, written for BonsaiDb
.
Pot is an encoding format used within BonsaiDb
. Its purpose is to
provide an encoding format for serde
that:
-
Is self-describing.
-
Is safe to run in production.
-
Is compact. While still being self-describing, Pot's main space-saving feature is not repeating symbols/identifiers more than one time while serializing. When serializing arrays of structures, this can make a major difference. The logs.rs example demonstrates this:
| | | | | | | | | | | | | ) | | | | | | | | ) | | | | | | |
Example
use ;
Outputs:
User serialized: [50, 6f, 74, 00, a2, c4, 69, 64, 40, 2a, c8, 6e, 61, 6d, 65, e5, 65, 63, 74, 6f, 6e]
User decoded as value: {id: 42, name: ecton}
Benchmarks
Because benchmarks can be subjective and often don't mirror real-world usage, this library's authors aren't making any specific performance claims. The way Pot achieves space savings requires some computational overhead. As such, it is expected that a hypothetically perfect CBOR implementation could outperform a hypothetically perfect Pot implementation.
The results from the current benchmark suite executed on GitHub Actions are viewable here. The current suite is only aimed at comparing the default performance for each library.
Serialize into new Vec<u8>
Serialize into reused Vec<u8>
Deserialize
Open-source Licenses
This project, like all projects from Khonsu Labs, is open-source. This repository is available under the MIT License or the Apache License 2.0.
To learn more about contributing, please see CONTRIBUTING.md.