Feature: Zero-copy datastore key serialisation and deserialisation #24
Labels
feature
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
topic:performance
Improvements to database performance
Is your feature request related to a problem?
Currently when creating
Vec<u8>
keys for use in the datastore, we pass in references, which are then cloned before being serialized. In addition when deserializing a datastore key, the value is cloned to create owned data.This is unnecessary as the datastore key is never used or held beyond the end of a local function.
Describe the solution
Zero-copy deserialization will ensure that we are not unnecessarily cloning &str values when serializing, and cloning data once again when deserializing.
With this improvement, writing to and reading from the key-value store should be quicker, with less memory allocation.
For this to work, we need to make the storekey deserializer accept borrowed data as can be seen in rmp-serde - https://github.com/3Hren/msgpack-rust/blob/master/rmp-serde/src/decode.rs#L909-L1003
Alternative methods
No alternative methods.
SurrealDB version
surreal 1.0.0-beta.5 for macos on aarch64
Contact Details
No response
Is there an existing issue for this?
Code of Conduct
The text was updated successfully, but these errors were encountered: