Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
0d179d17
Commit
0d179d17
authored
Sep 07, 2016
by
antirez
Browse files
dict.c benchmark minor improvements.
parent
bd6c4cad
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/dict.c
View file @
0d179d17
...
...
@@ -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
(
"
A
ccess
ing
existing"
);
end_benchmark
(
"
Random a
ccess
of
existing
elements
"
);
start_benchmark
();
for
(
j
=
0
;
j
<
count
;
j
++
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment