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
| #define ROBJECT_EMBED_LEN_MAX 3 | |
| struct RObject { | |
| struct RBasic basic; | |
| union { | |
| struct { | |
| long numiv; | |
| VALUE *ivptr; | |
| struct st_table *iv_index_tbl; /* shortcut for RCLASS_IV_INDEX_TBL(rb_obj_class(obj)) */ | |
| } heap; | |
| VALUE ary[ROBJECT_EMBED_LEN_MAX]; |
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 Callback | |
| def initialize(object = nil, method = :call, &b) | |
| @object, @method = object, method | |
| @object ||= b | |
| end | |
| def call(*args) | |
| @object.__send__(@method, *args) | |
| end | |
| end |
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 RubyCallback | |
| def initialize(object = nil, method = :call, &b) | |
| @object, @method = object, method | |
| @object ||= b | |
| end | |
| def call(*args) | |
| @object.__send__(@method, *args) | |
| end | |
| end |
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
| macbook-pros-computer:hwia lourens$ rake bench | |
| (in /Users/lourens/projects/hwia) | |
| ruby bench/bench.rb | |
| warning: Insecure world writable dir /Users/lourens in PATH, mode 040753 | |
| Rehearsal ------------------------------------------------------------------------------ | |
| StrHash#[:sym] 0.000000 0.000000 0.000000 ( 0.002916) | |
| HashWithIndifferentAccess#[:sym] 0.020000 0.000000 0.020000 ( 0.021839) | |
| StrHash#['str'] 0.010000 0.000000 0.010000 ( 0.012953) | |
| HashWithIndifferentAccess#['str] 0.000000 0.000000 0.000000 ( 0.003804) | |
| StrHash#key?(:sym) 0.000000 0.000000 0.000000 ( 0.002904) |
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
| ** Hooks for the Interpreter Events | |
| void rb_add_event_hook(rb_event_hook_func_t func, rb_event_t events) | |
| Adds a hook function for the specified interpreter events. | |
| events should be Or'ed value of: | |
| RUBY_EVENT_LINE | |
| RUBY_EVENT_CLASS | |
| RUBY_EVENT_END |
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:hwia lourens$ rake bench | |
| (in /Users/lourens/projects/hwia) | |
| ruby bench/bench.rb | |
| warning: Insecure world writable dir /Users/lourens in PATH, mode 040753 | |
| Rehearsal ------------------------------------------------------------------------------ | |
| StrHash#[:sym] 0.000000 0.000000 0.000000 ( 0.002867) | |
| HashWithIndifferentAccess#[:sym] 0.020000 0.000000 0.020000 ( 0.021870) | |
| StrHash#['str'] 0.010000 0.000000 0.010000 ( 0.012825) | |
| HashWithIndifferentAccess#['str] 0.000000 0.000000 0.000000 ( 0.003800) | |
| StrHash#key?(:sym) 0.000000 0.000000 0.000000 ( 0.002781) |
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
| macbook-pros-computer:hwia lourens$ rake bench | |
| (in /Users/lourens/projects/hwia) | |
| ruby bench/bench.rb | |
| warning: Insecure world writable dir /Users/lourens in PATH, mode 040753 | |
| Rehearsal -------------------------------------------------------------------- | |
| StrHash#[:sym] 0.000000 0.000000 0.000000 ( 0.002872) | |
| HashWithIndifferentAccess#[:sym] 0.020000 0.000000 0.020000 ( 0.021855) | |
| ----------------------------------------------------------- total: 0.020000sec | |
| user system total real |
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
| ELAPSED TIME DISTRIBUTION, dtrace | |
| numcmp | |
| value ------------- Distribution ------------- count | |
| 2048 | 0 | |
| 4096 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 19 | |
| 8192 | 0 | |
| st_init_strtable | |
| value ------------- Distribution ------------- count |
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 int | |
| rb_any_cmp(a, b) | |
| VALUE a, b; | |
| { | |
| VALUE args[2]; | |
| if (a == b) return 0; | |
| if (FIXNUM_P(a) && FIXNUM_P(b)) { | |
| return a != b; | |
| } |
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
| int | |
| rb_str_hash(str) | |
| VALUE str; | |
| { | |
| register long len = RSTRING(str)->len; | |
| register char *p = RSTRING(str)->ptr; | |
| register int key = 0; | |
| #if defined(HASH_ELFHASH) | |
| register unsigned int g; |