Skip to content
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

chore: add defrag for StringSet #4308

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

chore: add defrag for StringSet #4308

wants to merge 1 commit into from

Conversation

kostasrim
Copy link
Contributor

  • add defrag logic for StringSet
  • add test

Resolves #3822

@kostasrim kostasrim self-assigned this Dec 13, 2024
};

for (size_t i = 0; i < 10'000; i++)
ss_->Add(build_str(i));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would maybe worth to add a unit with ttl to be 100% sure we copy it properly. So two tests in total:

  1. As is now, without ttl
  2. With ttl

@@ -165,4 +165,44 @@ sds StringSet::MakeSetSds(string_view src, uint32_t ttl_sec) const {
return sdsnewlen(src.data(), src.size());
}

// Does not release obj. Callers must deallocate with sdsfree explicitly
pair<sds, bool> StringSet::DuplicateEntryIfFragmented(void* obj, float ratio) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Once I am back from the holidays I will see how to refactor those under one single function for all DenseSet variants. Furthermore, same applies for the tests

@romange
Copy link
Collaborator

romange commented Dec 14, 2024

It can wait for your return, I prefer not to merge it now

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

Successfully merging this pull request may close these issues.

Implement defragmentation for OBJ_ZSET and OBJ_SET
2 participants