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
| static int | |
| rb_any_hash(a) | |
| VALUE a; | |
| { | |
| VALUE hval; | |
| switch (TYPE(a)) { | |
| case T_FIXNUM: | |
| case T_SYMBOL: | |
| return (int)a; |
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 struct st_hash_type objhash = { | |
| rb_any_cmp, | |
| rb_any_hash, | |
| }; | |
| static VALUE | |
| hash_alloc(klass) | |
| VALUE klass; | |
| { | |
| VALUE hash = hash_alloc0(klass); |
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
| struct RHash { | |
| struct RBasic basic; | |
| struct st_table *tbl; | |
| int iter_lev; | |
| VALUE ifnone; | |
| }; |
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 | |
| strhash(register const char *string) | |
| { | |
| register int c; | |
| register int val = 0; | |
| while ((c = *string++) != '\0') { | |
| val = val*997 + c; | |
| } | |
| return val + (val>>5); | |
| } |
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
| /* hash.c */ | |
| static int | |
| rb_strhash_hash_cmp(VALUE a, VALUE b) | |
| { | |
| #ifdef RUBY18 | |
| VALUE args[2]; | |
| #endif | |
| if (a == b) return 0; | |
| if (FIXNUM_P(a) && FIXNUM_P(b)) return a != b; | |
| if (a == Qundef || b == Qundef) return -1; |
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 struct st_hash_type objstrhash = { | |
| rb_strhash_hash_cmp, | |
| rb_strhash_hash, | |
| }; | |
| static VALUE | |
| strhash_alloc(VALUE klass) | |
| { | |
| VALUE hash = strhash_alloc0(&klass); |
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 | |
| rb_strhash_convert(VALUE *val) | |
| { | |
| int i; | |
| VALUE values; | |
| switch (TYPE(*val)) { | |
| case T_HASH: | |
| *val = rb_hash_strhash(*val); | |
| break; |
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:rb_aio_native lourens$ rake bench | |
| (in /Users/lourens/projects/rb_aio_native) | |
| /opt/local/ruby19/bin/ruby bench/read.rb | |
| dir /Users/lourens in PATH, mode 040753 | |
| Rehearsal ------------------------------------------------------------- | |
| AIO.lio_listio(AIO::WAIT) 0.000000 0.000000 0.000000 ( 0.000154) | |
| IO.read 0.000000 0.000000 0.000000 ( 0.000346) | |
| ---------------------------------------------------- total: 0.000000sec | |
| 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
| methodmissing:rb_aio_native lourens$ rake bench | |
| (in /Users/lourens/projects/rb_aio_native) | |
| /opt/local/ruby19/bin/ruby bench/read.rb | |
| Rehearsal ------------------------------------------------------------- | |
| AIO.lio_listio(AIO::WAIT) 0.000000 0.000000 0.000000 ( 0.001029) | |
| IO.read 0.000000 0.000000 0.000000 ( 0.000424) | |
| ---------------------------------------------------- total: 0.000000sec | |
| user system total real | |
| AIO.lio_listio(AIO::WAIT) 0.000000 0.000000 0.000000 ( 0.000024) |