Skip to content

Instantly share code, notes, and snippets.

View methodmissing's full-sized avatar

Lourens Naudé methodmissing

View GitHub Profile
static VALUE
internal_read_func(void *ptr)
{
struct io_internal_struct *iis = (struct io_internal_struct*)ptr;
return read(iis->fd, iis->buf, iis->capa);
}
static VALUE
internal_write_func(void *ptr)
{
#include "ruby.h"
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <signal.h>
#include <fcntl.h>
#ifdef _POSIX_ASYNCHRONOUS_IO
#include <aio.h>
static VALUE
internal_read_func(void *ptr)
{
struct io_internal_struct *iis = (struct io_internal_struct*)ptr;
return read(iis->fd, iis->buf, iis->capa);
}
static VALUE
internal_write_func(void *ptr)
{
=begin
macbook-pros-computer:~ lourens$ ruby gc.rb
Collected 1112060
Collected 1112130
Collected 1112200
Collected 1112270
Collected 1112340
=end
include ObjectSpace
/* Tests for AIO in librt.
Copyright (C) 1998,2000,02 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
#
# = ostruct.rb: OpenStruct implementation
#
# Author:: Yukihiro Matsumoto
# Documentation:: Gavin Sinclair
#
# OpenStruct allows the creation of data objects with arbitrary attributes.
# See OpenStruct for an example.
#
macbook-pros-computer:callback lourens$ rake bench
(in /Users/lourens/projects/callback)
/opt/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:992: warning: Insecure world writable dir /Users/lourens in PATH, mode 040753
Rehearsal ---------------------------------------------------------------------------------
Callback{ 'hai' }.call 0.010000 0.000000 0.010000 ( 0.018309)
RubyCallback{ 'hai' }.call 0.030000 0.000000 0.030000 ( 0.025148)
Callback( 'bai', :to_s ).call 0.000000 0.000000 0.000000 ( 0.007654)
RubyCallback( 'bai', :to_s ).call 0.020000 0.000000 0.020000 ( 0.014259)
Callback( 'bai', :gsub ).call( 'b', 'h' ) 0.040000 0.000000 0.040000 ( 0.041170)
RubyCallback( 'bai', :gsub ).call( 'b', 'h' ) 0.060000 0.000000 0.060000 ( 0.061157)
macbook-pros-computer:callback lourens$ rake bench
(in /Users/lourens/projects/callback)
ruby bench/bench.rb
warning: Insecure world writable dir /Users/lourens in PATH, mode 040753
Rehearsal ---------------------------------------------------------------------------------
Callback{ 'hai' }.call 0.030000 0.000000 0.030000 ( 0.035305)
RubyCallback{ 'hai' }.call 0.060000 0.000000 0.060000 ( 0.063904)
Callback( 'bai', :to_s ).call 0.020000 0.000000 0.020000 ( 0.010352)
RubyCallback( 'bai', :to_s ).call 0.030000 0.000000 0.030000 ( 0.035379)
Callback( 'bai', :gsub ).call( 'b', 'h' ) 0.030000 0.000000 0.030000 ( 0.027821)
macbook-pros-computer:~ lourens$ ruby as_bench.rb
Rehearsal ----------------------------------------------------------------------------
Hash#faster_diff 0.100000 0.000000 0.100000 ( 0.103662)
Hash#diff 0.120000 0.000000 0.120000 ( 0.116199)
Hash#faster_deep_merge 0.020000 0.000000 0.020000 ( 0.027282)
Hash#deep_merge 0.030000 0.000000 0.030000 ( 0.032799)
FasterHashWithIndifferentAccess#to_hash 0.020000 0.000000 0.020000 ( 0.025512)
HashWithIndifferentAccess#to_hash 0.040000 0.000000 0.040000 ( 0.039692)
Hash#faster_reverse_merge! 0.020000 0.000000 0.020000 ( 0.026483)
Hash#reverse_merge! 0.060000 0.000000 0.060000 ( 0.053396)
macbook-pros-computer:~ lourens$ ruby as_bench.rb
Rehearsal ----------------------------------------------------------------------------
Hash#faster_diff 0.100000 0.000000 0.100000 ( 0.103207)
Hash#diff 0.120000 0.000000 0.120000 ( 0.118790)
Hash#faster_deep_merge 0.030000 0.000000 0.030000 ( 0.027385)
Hash#deep_merge 0.030000 0.000000 0.030000 ( 0.032819)
FasterHashWithIndifferentAccess#to_hash 0.030000 0.000000 0.030000 ( 0.027202)
HashWithIndifferentAccess#to_hash 0.030000 0.000000 0.030000 ( 0.032386)
Hash#faster_reverse_merge! 0.030000 0.000000 0.030000 ( 0.032605)
Hash#reverse_merge! 0.040000 0.000000 0.040000 ( 0.045057)