Skip to content

Allow custom key generators#70

Merged
horgh merged 5 commits intomainfrom
greg/perf-improvements
Oct 5, 2023
Merged

Allow custom key generators#70
horgh merged 5 commits intomainfrom
greg/perf-improvements

Conversation

@oschwald
Copy link
Member

@oschwald oschwald commented Oct 3, 2023

A custom key generator can significantly improve the insertion performance
when you are able to use domain knowledge of the specific data being
inserted to more efficiently generate a unique key.

This also has some small performance improvements when using the default
key generator.

The default key generator is quite conservative, serializing the entire
record and generating a SHA-256 hash from it. For large data records
with many strings, this can be quite expensive. Using a custom key
generator allows you to use knowledge of the particular data being
inserted to generate a unique key using fewer resources.
This is safe as we don't story the key as is. If it is stored, it is
first converted to a dataMapKey, which is a string type.
data_key.go Outdated
// data.
//
// Please be certain that any key you generate is unique. If there is a
// collision with two different values having the same key, ones of the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"one"

@horgh horgh merged commit 5199b97 into main Oct 5, 2023
@horgh horgh deleted the greg/perf-improvements branch October 5, 2023 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants