mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
dict.c benchmark minor improvements.
This commit is contained in:
parent
bd6c4cade6
commit
0d179d17ba
20
src/dict.c
20
src/dict.c
@ -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++) {
|
||||
|
Loading…
Reference in New Issue
Block a user