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
# zero-copy enable-disable test | |
require 'msgpack' | |
require 'benchmark' | |
LOOP = 100000 | |
sizes = [10,100,1000,10000] | |
sizes.map! {|sz| [sz, MessagePack.pack("a"*sz)] } | |
Benchmark.benchmark(' ' * 30 + Benchmark::Tms::CAPTION, 30) do |b| |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <stdint.h> | |
#include <stdbool.h> | |
#include <pthread.h> | |
#include <libmemcached/memcached.h> | |
const char* g_host = "127.0.0.1"; | |
unsigned short g_port = 11211; |
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 <iostream> | |
#include <msgpack.hpp> | |
// source file | |
void doit_impl(void (*func)(void*, const char*, size_t), void* obj) | |
{ | |
for(int i=0; i < 10; ++i) { | |
(*func)(obj, "test", 4); | |
} | |
} |
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
diff --git a/src/gate/memproto/memtext.c b/src/gate/memproto/memtext.c | |
index 9c2b1da..89dec2c 100644 | |
--- a/src/gate/memproto/memtext.c | |
+++ b/src/gate/memproto/memtext.c | |
@@ -85,13 +85,13 @@ static const unsigned char _memtext_key_offsets[] = { | |
111, 112, 113, 114, 115, 119, 120, 121, | |
122, 123, 127, 131, 132, 136, 138, 139, | |
140, 141, 142, 143, 144, 145, 146, 150, | |
- 151, 152, 154, 158, 162, 163, 167, 168, | |
- 169, 170, 171, 172, 173, 174, 175, 176, |
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 <msgpack.hpp> | |
#include <iostream> | |
struct myclass { | |
int num; | |
std::string str; | |
MSGPACK_DEFINE(num, str); | |
}; | |
int main(void) |
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 <msgpack.hpp> | |
#include <iostream> | |
#include <sys/time.h> | |
#include <vector> | |
struct simple_timer { | |
void reset() { gettimeofday(&m_timeval, NULL); } | |
void show() | |
{ | |
struct timeval endtime; |
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 <msgpack.hpp> | |
#include <tr1/memory> | |
#include <iostream> | |
class dynamic { | |
public: | |
typedef std::tr1::shared_ptr<msgpack::zone> shared_zone; | |
dynamic() { } |
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
#### | |
## Overview | |
## | |
# | |
# RPCError | |
# | | |
# +-- TimeoutError | |
# | | |
# +-- ClientError |
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
require 'rubygems' | |
require 'rev/websocket' | |
$connections = [] | |
class MyConnection < Rev::WebSocket | |
def on_open | |
puts "WebSocket opened" | |
$connections << self | |
end |
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
require 'rubygems' | |
require 'msgpack' | |
require 'json' | |
File.open(ARGV[0]) do |f| | |
begin | |
MessagePack::Unpacker.new(f).each {|obj| | |
puts obj.to_json | |
} | |
rescue EOFError |