Skip to content

Instantly share code, notes, and snippets.

View methodmissing's full-sized avatar

Lourens Naudé methodmissing

View GitHub Profile
methodmissing:rubyenterpriseedition187-248 lourens$ ./orig_ruby -Ilib lazy_mem_bench.rb
user system total real
Hash.new 0.100000 0.000000 0.100000 ( 0.103147)
Hash#[] 0.130000 0.000000 0.130000 ( 0.125913)
Hash#size 0.110000 0.000000 0.110000 ( 0.111521)
Hash['a','b'].keys 0.170000 0.000000 0.170000 ( 0.177375)
Class.new 1.050000 0.010000 1.060000 ( 1.055517)
Module.new 0.510000 0.000000 0.510000 ( 0.510009)
B.new.extend(A) 1.340000 0.000000 1.340000 ( 1.335759)
Allocated 134418009 bytes
diff --git a/benchmark/setup_db.rb b/benchmark/setup_db.rb
index 4f1cfe7..a3718c2 100644
--- a/benchmark/setup_db.rb
+++ b/benchmark/setup_db.rb
@@ -24,6 +24,7 @@ create_table_sql = %[
float_test FLOAT(10,3),
double_test DOUBLE(10,3),
decimal_test DECIMAL(10,3),
+ decimal_zero_test DECIMAL(10,3),
date_test DATE,
typedef struct st_mysql
{
NET net; /* Communication parameters */
unsigned char *connector_fd; /* ConnectorFd for SSL */
char *host,*user,*passwd,*unix_socket,*server_version,*host_info;
char *info, *db;
struct charset_info_st *charset;
MYSQL_FIELD *fields;
MEM_ROOT field_alloc;
my_ulonglong affected_rows;
methodmissing:mysql2 lourens$ rake bench:allocations
(in /Users/lourens/projects/mysql2)
/Users/lourens/.rvm/rubies/ruby-1.9.2-rc1/bin/ruby benchmark/allocations.rb
GC overhead for coercion
GC 33 invokes.
Index Invoke Time(sec) Use Size(byte) Total Size(byte) Total Object GC Time(ms)
1 0.488 2372720 4063232 101432 10.68299999999999805311
2 0.524 3207680 4063232 101432 9.44599999999995532107
3 0.555 3449680 4079616 101841 10.75899999999996303757
4 0.677 2868520 7307264 182414 17.51800000000003265654
diff --git a/ext/mysql2/client.c b/ext/mysql2/client.c
index 258f3fb..11cd968 100644
--- a/ext/mysql2/client.c
+++ b/ext/mysql2/client.c
@@ -7,6 +7,12 @@ static VALUE intern_encoding_from_charset;
static ID sym_id, sym_version, sym_async, sym_symbolize_keys, sym_as, sym_array;
static ID intern_merge, intern_error_number_eql, intern_sql_state_eql;
+#ifdef HAVE_RUBY_ENCODING_H
+#define GET_ENCODING(client) \
diff --git a/ext/mysql2/client.c b/ext/mysql2/client.c
index 258f3fb..57f49de 100644
--- a/ext/mysql2/client.c
+++ b/ext/mysql2/client.c
@@ -17,8 +17,10 @@ static ID intern_merge, intern_error_number_eql, intern_sql_state_eql;
rb_iv_set(conn, "@active", Qfalse);
#define GET_CLIENT(self) \
+ mysql_client_wrapper * wrapper; \
MYSQL * client; \
From 67da63b1bec8ba5fe0c71e019f1d287e447ca566 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lourens=20Naud=C3=A9?= <lourens@methodmissing.com>
Date: Thu, 3 Feb 2011 01:05:41 +0000
Subject: [PATCH] RECYCLE, RECYCLETO and DISPOSE commands supporting a Dead Letter Channel infrastructure for expired keys
---
src/db.c | 27 ++++++++++++++++++++++++++-
src/help.h | 17 ++++++++++++++++-
src/redis.c | 11 ++++++++---
src/redis.h | 5 +++++
diff --git a/src/db.c b/src/db.c
index 669fba1..6ae83d3 100644
--- a/src/db.c
+++ b/src/db.c
@@ -514,7 +514,8 @@ void propagateExpire(redisDb *db, robj *key) {
argv[0] = createStringObject("DEL",3);
argv[1] = key;
incrRefCount(key);
-
+ if (db->expire_channel)
Lourenss-MacBook-Air:rbczmq lourens$ ruby perf/local_thr.rb tcp://127.0.0.1:5020 10 1000000
message size: 10 [B]
message count: 1000000
mean throughput: 410276 [msg/s]
mean throughput: 32.822 [Mb/s]
Lourenss-MacBook-Air:rbczmq lourens$ ruby perf/local_thr.rb tcp://127.0.0.1:5020 100 1000000
message size: 100 [B]
message count: 1000000
mean throughput: 293891 [msg/s]
mean throughput: 235.113 [Mb/s]
lourens@solaris:~/libxs/perf/.libs$ sudo dtrace -Z -n "xs*:::send-command-start{ trace(arg1); }" -c "./inproc_lat 100 100"
dtrace: description 'xs*:::send-command-start' matched 0 probes
message size: 100 [B]
roundtrip count: 100
average latency: 12.825 [us]
CPU ID FUNCTION:NAME
0 71132 _ZN2xs8object_t12send_commandERNS_9command_tE:send-command-start 4
0 71132 _ZN2xs8object_t12send_commandERNS_9command_tE:send-command-start 5
0 71132 _ZN2xs8object_t12send_commandERNS_9command_tE:send-command-start 5
0 71132 _ZN2xs8object_t12send_commandERNS_9command_tE:send-command-start 5