Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
hiredis
Commits
60f622b8
Commit
60f622b8
authored
May 20, 2018
by
michael-grunder
Browse files
Add an integer parsing heavy workload to throughput testing
parent
7bef042c
Changes
1
Hide whitespace changes
Inline
Side-by-side
test.c
View file @
60f622b8
...
@@ -692,6 +692,17 @@ static void test_throughput(struct config config) {
...
@@ -692,6 +692,17 @@ static void test_throughput(struct config config) {
free
(
replies
);
free
(
replies
);
printf
(
"
\t
(%dx LRANGE with 500 elements: %.3fs)
\n
"
,
num
,
(
t2
-
t1
)
/
1000000
.
0
);
printf
(
"
\t
(%dx LRANGE with 500 elements: %.3fs)
\n
"
,
num
,
(
t2
-
t1
)
/
1000000
.
0
);
replies
=
malloc
(
sizeof
(
redisReply
*
)
*
num
);
t1
=
usec
();
for
(
i
=
0
;
i
<
num
;
i
++
)
{
replies
[
i
]
=
redisCommand
(
c
,
"INCRBY incrkey %lld"
,
10000000
);
assert
(
replies
[
i
]
!=
NULL
&&
replies
[
i
]
->
type
==
REDIS_REPLY_INTEGER
);
}
t2
=
usec
();
for
(
i
=
0
;
i
<
num
;
i
++
)
freeReplyObject
(
replies
[
i
]);
free
(
replies
);
printf
(
"
\t
(%dx INCRBY: %.3fs)
\n
"
,
num
,
(
t2
-
t1
)
/
1000000
.
0
);
num
=
10000
;
num
=
10000
;
replies
=
malloc
(
sizeof
(
redisReply
*
)
*
num
);
replies
=
malloc
(
sizeof
(
redisReply
*
)
*
num
);
for
(
i
=
0
;
i
<
num
;
i
++
)
for
(
i
=
0
;
i
<
num
;
i
++
)
...
@@ -720,6 +731,19 @@ static void test_throughput(struct config config) {
...
@@ -720,6 +731,19 @@ static void test_throughput(struct config config) {
free
(
replies
);
free
(
replies
);
printf
(
"
\t
(%dx LRANGE with 500 elements (pipelined): %.3fs)
\n
"
,
num
,
(
t2
-
t1
)
/
1000000
.
0
);
printf
(
"
\t
(%dx LRANGE with 500 elements (pipelined): %.3fs)
\n
"
,
num
,
(
t2
-
t1
)
/
1000000
.
0
);
replies
=
malloc
(
sizeof
(
redisReply
*
)
*
num
);
for
(
i
=
0
;
i
<
num
;
i
++
)
redisAppendCommand
(
c
,
"INCRBY incrkey %lld"
,
10000000
);
t1
=
usec
();
for
(
i
=
0
;
i
<
num
;
i
++
)
{
assert
(
redisGetReply
(
c
,
(
void
*
)
&
replies
[
i
])
==
REDIS_OK
);
assert
(
replies
[
i
]
!=
NULL
&&
replies
[
i
]
->
type
==
REDIS_REPLY_INTEGER
);
}
t2
=
usec
();
for
(
i
=
0
;
i
<
num
;
i
++
)
freeReplyObject
(
replies
[
i
]);
free
(
replies
);
printf
(
"
\t
(%dx INCRBY (pipelined): %.3fs)
\n
"
,
num
,
(
t2
-
t1
)
/
1000000
.
0
);
disconnect
(
c
,
0
);
disconnect
(
c
,
0
);
}
}
...
...
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