Created
November 21, 2014 06:50
-
-
Save ymmt2005/c03c1f828bfedfe76c46 to your computer and use it in GitHub Desktop.
Benchmarking yrmcds memcache text parser.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "../src/memcache/memcache.hpp" | |
#include <cybozu/test.hpp> | |
#include <cassert> | |
#include <cerrno> | |
#include <cstdint> | |
#include <cstring> | |
#include <ctime> | |
#include <iostream> | |
#include <limits> | |
#include <stdlib.h> | |
using namespace yrmcds; | |
using namespace yrmcds::memcache; | |
#define MEMCACHE_TEST(n, d) \ | |
char data##n[] = d; \ | |
text_request t##n(data##n, sizeof(data##n) - 1); | |
AUTOTEST(speed) { | |
for( int i = 0; i < 1000000; i++ ) { | |
MEMCACHE_TEST(1, "\r\n"); | |
MEMCACHE_TEST(2, "set aaa 100 0 5\r\nabcde\r\nset aaa"); | |
MEMCACHE_TEST(3, "set aaa 100 0 10 \r\nabcdefghij\r\naaa"); | |
MEMCACHE_TEST(4, "set aaa 100 0 10 noreply \r\nabcdefghij\r\naaa"); | |
MEMCACHE_TEST(5, "add aaa 100 0 10 noreply\r\nabcdefghij\r\n"); | |
MEMCACHE_TEST(6, "replace aaa 100 0 10 noreply \r\nabcdefghij\r\n"); | |
MEMCACHE_TEST(7, "touch abcd 0 \r\nabc"); | |
MEMCACHE_TEST(8, "touch abcd 100 noreply\r\nabc"); | |
MEMCACHE_TEST(9, "get 38338 \r\nabc"); | |
MEMCACHE_TEST(10, "get 38338 4\r\nabc"); | |
MEMCACHE_TEST(11, "gets 38338 \r\nabc"); | |
MEMCACHE_TEST(12, "get 38338 \r\nabc"); | |
MEMCACHE_TEST(13, "get 38338 4\r\nabc"); | |
MEMCACHE_TEST(14, "gets 38338 \r\nabc"); | |
MEMCACHE_TEST(15, "get 38338 \r\nabc"); | |
MEMCACHE_TEST(16, "get 38338 4\r\nabc"); | |
MEMCACHE_TEST(17, "gets 38338 \r\nabc"); | |
MEMCACHE_TEST(18, "get 38338 \r\nabc"); | |
} | |
} |
18000000 / 0.941572 ≒ 1912 万 op/s
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Result: