Skip to content

Instantly share code, notes, and snippets.

View methodmissing's full-sized avatar

Lourens Naudé methodmissing

View GitHub Profile
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;
}
static int
rb_any_hash(a)
VALUE a;
{
VALUE hval;
switch (TYPE(a)) {
case T_FIXNUM:
case T_SYMBOL:
return (int)a;
static struct st_hash_type objhash = {
rb_any_cmp,
rb_any_hash,
};
static VALUE
hash_alloc(klass)
VALUE klass;
{
VALUE hash = hash_alloc0(klass);
struct RHash {
struct RBasic basic;
struct st_table *tbl;
int iter_lev;
VALUE ifnone;
};
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);
}
/* 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;
static struct st_hash_type objstrhash = {
rb_strhash_hash_cmp,
rb_strhash_hash,
};
static VALUE
strhash_alloc(VALUE klass)
{
VALUE hash = strhash_alloc0(&klass);
static void
rb_strhash_convert(VALUE *val)
{
int i;
VALUE values;
switch (TYPE(*val)) {
case T_HASH:
*val = rb_hash_strhash(*val);
break;
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
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)