forked from shangqi-lai/SDSSE
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSDSSECQ.cpp
More file actions
46 lines (40 loc) · 1.97 KB
/
SDSSECQ.cpp
File metadata and controls
46 lines (40 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <chrono>
#include "Core/SDSSECQClient.h"
using namespace chrono;
int main(int argc, char *argv[]) {
if (argc != 4) {
cout << "Incorrect Arguments" << endl;
cout << "The program needs to be run with ./SDSSECQS [w1 size] [w2 size] [Deletion Size]" << endl;
return -1;
}
int w1_size = atoi(argv[1]);
int w2_size = atoi(argv[2]);
int del_size = atoi(argv[3]);
SDSSECQClient client(1, del_size);
auto start = duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
for (int i = 0; i < w1_size; ++i) {
client.update(INS, "alice", i);
}
for (int i = 0; i < w2_size; ++i) {
client.update(INS, "bob", i);
}
auto end = duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
cout << (float) (end - start) / (float) (w1_size + w2_size) << " us per insertion" << endl;
start = duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
for (int i = 0; i < del_size; ++i) {
client.update(DEL, "alice", i);
client.update(DEL, "bob", i);
}
end = duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
cout << (float) (end - start) / 2 / (float) del_size << " us per deletion" << endl;
// search the database
start = duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
vector<int> single_results = client.search(1, "alice");
end = duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
cout << "Single Keyword Search Time: " << (float)(end - start) / 1000 << " ms" << endl;
start = duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
vector<int> conjunctive_results = client.search(2, "alice", "bob");
end = duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
cout << "Two-Keyword Conjunctive Search Time: " << (float)(end - start) / 1000 << " ms" << endl;
return 0;
}