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

Why lookupKey function doesn't work as expected? #6

Open
lyupy opened this issue Apr 10, 2019 · 0 comments
Open

Why lookupKey function doesn't work as expected? #6

lyupy opened this issue Apr 10, 2019 · 0 comments

Comments

@lyupy
Copy link

lyupy commented Apr 10, 2019

I use 10000 key to build SuRF, and then lookup those key , but SuRF miss some key?

// test code
std::vector<std::string> keys;
for (int i = 0; i < 10000; i++) {
    keys.push_back(std::to_string(i));
}
// basic surf
SuRF* surf = new SuRF(keys);

// use default dense-to-sparse ratio; specify suffix type and length
SuRF* surf_hash = new SuRF(keys, surf::kHash, 8, 0);
SuRF* surf_real = new SuRF(keys, surf::kReal, 0, 8);

// customize dense-to-sparse ratio; specify suffix type and length
SuRF* surf_mixed = new SuRF(keys, true, 16,  surf::kMixed, 4, 4);

int n_error = 0;
int n_correct = 0;
for (int i = 0; i < 10000; i++) {
    if (surf->lookupKey(std::to_string(i)))
        n_correct++;
    else
        n_error++;
}
std::cout << "num:"<< n_error << ":" << n_correct << std::endl;

num:9:9991

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

No branches or pull requests

1 participant