Skip to content

Add variable size prefix for microbench/db_basic_bench.cc KeyGenerator class + improve documentation #13709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

KareemOtoum
Copy link

This pr adds an unfinished feature in the KeyGenerator class at microbench/db_basic_bench.cc, removing the hard-coded limit for the prefix size of the key generator and improves the documentation of the class.

if (prefix_num > 0) {
      prefix_size_ = 4;  // TODO: support different prefix_size
    }

Previously, the key generator would accept an optional prefix and force a limit of 4 bytes if one was provided. The changes in this pr make it so that the constructor accepts a size_t prefix_size = 4 as a parameter to represent the desired bytes for the keys prefix. An assert ensures that the size can represent the given size_t prefix_num.

To support this new feature's addition, the Encode function was also changed to accept a size parameter for encoding a variable size key/prefix while preserving endianness.

This change improves flexibility for key generation in benchmarks and tests.

As a next step, I plan to explore increasing the maximum number of keys (max_keys_) that can be generated, which is currently limited by an assert. Feedback on this approach or suggestions for future improvements are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants