提交 0d179d17 编写于 作者: A antirez

dict.c benchmark minor improvements.

上级 bd6c4cad
......@@ -1155,6 +1155,24 @@ int main(int argc, char **argv) {
dictRehashMilliseconds(dict,100);
}
start_benchmark();
for (j = 0; j < count; j++) {
sds key = sdsfromlonglong(j);
dictEntry *de = dictFind(dict,key);
assert(de != NULL);
sdsfree(key);
}
end_benchmark("Linear access of existing elements");
start_benchmark();
for (j = 0; j < count; j++) {
sds key = sdsfromlonglong(j);
dictEntry *de = dictFind(dict,key);
assert(de != NULL);
sdsfree(key);
}
end_benchmark("Linear access of existing elements (2nd round)");
start_benchmark();
for (j = 0; j < count; j++) {
sds key = sdsfromlonglong(rand() % count);
......@@ -1162,7 +1180,7 @@ int main(int argc, char **argv) {
assert(de != NULL);
sdsfree(key);
}
end_benchmark("Accessing existing");
end_benchmark("Random access of existing elements");
start_benchmark();
for (j = 0; j < count; j++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册