This file contains hidden or 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/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; \ |
This file contains hidden or 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/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) \ |
This file contains hidden or 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
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 |
This file contains hidden or 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
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; |
This file contains hidden or 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/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, |
This file contains hidden or 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
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 |
This file contains hidden or 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
static void | |
create_sigstack() | |
{ | |
stack_t ss; | |
ss.ss_size = SIGSTKSZ; | |
ss.ss_sp = malloc(ss.ss_size); | |
ss.ss_flags = 0; | |
if (sigaltstack(&ss, NULL) < 0) { | |
free(ss.ss_sp); | |
fprintf(stderr, "Couldn't create signal stack! Error %d: %s\n", errno, strerror(errno)); |
This file contains hidden or 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
class HashExtTest < Test::Unit::TestCase | |
def setup | |
@strings = { 'a' => 1, 'b' => 2 } | |
@symbols = { :a => 1, :b => 2 } | |
@mixed = { :a => 1, 'b' => 2 } | |
@fixnums = { 0 => 1, 1 => 2 } | |
if RUBY_VERSION < '1.9.0' | |
@illegal_symbols = { "\0" => 1, "" => 2, [] => 3 } | |
else | |
@illegal_symbols = { [] => 3 } |
This file contains hidden or 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
methodmissing:callsite lourens$ rake bench | |
(in /Users/lourens/projects/callsite) | |
ruby bench/bench.rb | |
Rehearsal ------------------------------------------------ | |
rb_callsite 0.820000 0.000000 0.820000 ( 0.834258) | |
callsite 0.060000 0.000000 0.060000 ( 0.059037) | |
callsite(5) 0.030000 0.000000 0.030000 ( 0.034046) | |
callsite(10) 0.020000 0.000000 0.020000 ( 0.021931) | |
--------------------------------------- total: 0.930000sec |
This file contains hidden or 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 'benchmark' | |
class Hash | |
def orig_symbolize_keys! | |
keys.each do |key| | |
self[(key.to_sym rescue key) || key] = delete(key) | |
end | |
self | |
end |