Skip to content

Instantly share code, notes, and snippets.

View methodmissing's full-sized avatar

Lourens Naudé methodmissing

View GitHub Profile
diff --git a/hash.c b/hash.c
index ef8b9a8..bd60d5a 100644
--- a/hash.c
+++ b/hash.c
@@ -33,8 +33,7 @@ rb_hash_freeze(VALUE hash)
VALUE rb_cHash;
static VALUE envtbl;
-static ID id_hash, id_yield, id_default;
-
methodmissing:ruby lourens$ git diff --patch-with-stat github/trunk..HEAD
gc.c | 1 +
hash.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++-
include/ruby/ruby.h | 2 +
test/ruby/test_hash.rb | 36 ++++++++++++++++++++++++
4 files changed, 107 insertions(+), 2 deletions(-)
diff --git a/gc.c b/gc.c
index 7711101..55cdb85 100644
--- a/gc.c
methodmissing:ruby lourens$ sudo dtrace -ln 'ruby*:::'
ID PROVIDER MODULE FUNCTION NAME
20534 ruby46744 ruby rb_thread_call_with_gvl gvm_lock_begin-location
20535 ruby46744 ruby do_select gvm_lock_begin-location
20536 ruby46744 ruby rb_thread_blocking_region gvm_lock_begin-location
20537 ruby46744 ruby rb_thread_blocking_region_begin gvm_lock_begin-location
20538 ruby46744 ruby rb_thread_call_with_gvl gvm_lock_end-location
20539 ruby46744 ruby rb_thread_blocking_region_end gvm_lock_end-location
20540 ruby46744 ruby do_select gvm_lock_end-location
20541 ruby46744 ruby rb_thread_blocking_region gvm_lock_end-location
methodmissing:ruby lourens$ gdb miniruby
GNU gdb 6.3.50-20050815 (Apple version gdb-1344) (Fri Jul 3 01:19:56 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
#41 0x0000000100039568 in rb_protect (proc=0x100002160 <require_enc>, data=4303907720, state=0x0) at eval.c:688
#42 0x0000000100002a0a in load_encoding (name=0x100177c95 "UTF8-MAC") at encoding.c:522
#43 0x0000000100003388 in rb_enc_find_index (name=0x100177c95 "UTF8-MAC") at encoding.c:562
#44 0x00000001000034de in rb_enc_find (name=<value temporarily unavailable, due to optimizations>) at encoding.c:582
#45 0x000000010004292b in file_path_convert (name=4303907760) at file.c:114
require "benchmark"
$:.unshift "."
HASH = { :d => :d, 'e' => :e, 2 => 2 }
TESTS = 100_000
Benchmark.bmbm do |results|
results.report("Hash#[:sym]") { TESTS.times { HASH[:d] } }
results.report("Hash#[:str]") { TESTS.times { HASH['e'] } }
results.report("Hash#[:fix]") { TESTS.times { HASH[2] } }
_dispatch_table.8309:
.quad L2577
.quad L2577
.quad L2577
.quad L2069
.quad L1568
.quad L1595
.quad L1647
.quad L1609
.quad L1588
diff --git a/configure.in b/configure.in
index ac63760..0211b14 100644
--- a/configure.in
+++ b/configure.in
@@ -669,6 +669,24 @@ if test "$use_setreuid" = yes; then
AC_DEFINE(USE_SETREUID)
AC_DEFINE(USE_SETREGID)
fi
+
+AC_ARG_ENABLE(threaded-dispatch,
L1622:
# basic block 74
movq -112(%rbp), %rax
movq %rax, _ruby_current_node(%rip)
movq -112(%rbp), %rax
movq (%rax), %rax
shrq $12, %rax
andl $255, %eax
cltq
leaq 0(,%rax,8), %rdx
diff --git a/configure.in b/configure.in
index ac63760..5897782 100644
--- a/configure.in
+++ b/configure.in
@@ -669,6 +669,24 @@ if test "$use_setreuid" = yes; then
AC_DEFINE(USE_SETREUID)
AC_DEFINE(USE_SETREGID)
fi
+
+AC_ARG_ENABLE(threaded-dispatch,
sched_yield() = 0
sched_yield() = 0
sched_yield() = 0
sched_yield() = 0
sched_yield() = 0
sched_yield() = 0
sched_yield() = 0
sched_yield() = 0
sched_yield() = 0
sched_yield() = 0