Closed gcxfd closed 2 years ago
You can use any serialization framework with BonsaiDb. The high-level interface revolves around SerializedCollection
, but if for some reason you're not able to implement that trait, you can use the "lower-level" API that returns OwnedDocument
instances instead of CollectionDocument<T>
instances. OwnedDocument
as a contents
field that is the raw bytes stored in the database.
By default, BonsaiDb uses Pot
, which is a self-describing Serde-compatible format. While it will not be as fast as speedy or bincode, it is quite efficient, but more importantly it fits BonsaiDb's goals: a general purpose database. Self-describing formats are much easier to handle migrating from one version to another, as you can handle things like reordering or renaming fields without requiring multiple versions of the parser.
For users who are looking for absolute performance and are willing to solve the multi-version issue whenever it comes up, BonsaiDb can still be customized to fit your needs.
speedy is faster than serde
https://docs.rs/speedy/latest/speedy/ https://github.com/koute/serde-bench https://github.com/djkoloski/rust_serialization_benchmark