Skip to content

Instantly share code, notes, and snippets.

View stormbrew's full-sized avatar

stormbrew stormbrew

  • Edmonton, Alberta, Canada
View GitHub Profile
From a3f952616a416480f9f382248c39d0f37b1385b2 Mon Sep 17 00:00:00 2001
From: Graham <graham-storm-git@ript.net>
Date: Thu, 28 Jan 2010 15:46:33 -0700
Subject: [PATCH 1/2] Updated spec for issue when raising an object instance with a message
In MRI, the internal behaviour when passed an object instance as the first argument and a message as the second argument to raise is to clone the object and call the internal (original) initialize on the object. This makes it so that message is set even if the derived initialize doesn't take a message argument.'
---
spec/ruby/language/rescue_spec.rb | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
Program received signal SIGINT, Interrupt.
0x9243046e in __semwait_signal ()
(gdb) bt
#0 0x9243046e in __semwait_signal ()
#1 0x9245b3e6 in _pthread_cond_wait ()
#2 0x9245adcd in pthread_cond_wait$UNIX2003 ()
#3 0x000bc158 in thread::Condition::wait (this=0x4, mutex=@0x4) at thread.hpp:376
#4 0x000e67de in rubinius::Channel::receive_timeout (this=0x22994dc, state=0xf00ee0, duration=0x1a, call_frame=0xbfffd500) at vm/builtin/channel.cpp:122
#5 0x000e6b37 in rubinius::Channel::receive (this=0x4, state=0x4, call_frame=0x4) at vm/builtin/channel.cpp:66
#6 0x00081acf in rubinius::Primitives::channel_receive (state=0xf00ee0, call_frame=0xbfffd500, msg=@0x11c43e0, args=@0xbfffd49c) at primitives_glue.gen.cpp:3949
From 74958fc6092010d8f9d55e569d4276e9b6109523 Mon Sep 17 00:00:00 2001
From: Graham <graham-git@stormbrew.ca>
Date: Thu, 28 Jan 2010 15:46:33 -0700
Subject: [PATCH 1/2] Updated spec for issue when raising an object instance with a message
---
spec/ruby/core/exception/exception_spec.rb | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/spec/ruby/core/exception/exception_spec.rb b/spec/ruby/core/exception/exception_spec.rb
We couldn’t find that file to show.
% cumulative self self total
time seconds seconds calls ms/call ms/call name
------------------------------------------------------------
4.08 1.77 1.51 3646050 0.00 0.00 Kernel#===
3.35 1.79 1.24 700613 0.00 0.00 Array#[]
2.77 4.50 1.02 144276 0.01 0.03 String#each_byte
2.60 0.95 0.96 145632 0.01 0.01 Rubinius::VM.reset_method_cache
2.53 1.45 0.94 316669 0.00 0.00 String#[]
2.52 2.13 0.93 546247 0.00 0.00 Hash#find_entry
2.26 2.18 0.84 60606 0.01 0.04 String#tr_trans
% cumulative self self total
time seconds seconds calls ms/call ms/call name
------------------------------------------------------------
4.10 0.88 0.88 140000 0.01 0.01 Rubinius::VM.reset_method_cache
4.08 2.02 0.88 530001 0.00 0.00 Hash#find_entry
3.83 2.09 0.83 60000 0.01 0.03 String#tr_trans
2.37 0.65 0.51 557501 0.00 0.00 Hash::Entry#match?
2.10 0.55 0.45 100000 0.00 0.01 Hash::Iterator#next
1.99 0.57 0.43 800000 0.00 0.00 Type.coerce_to
1.79 0.83 0.39 200000 0.00 0.00 Rubinius::Tuple#dup
backend neogaf_user {
.host = "php2";
.port = "80";
.max_connections = 200;
.connect_timeout = 600s;
.first_byte_timeout = 600s;
.between_bytes_timeout = 600s;
}
/*backend neogaf_guest {
.host = "php2";
# A tree structure that contains parse error messages. This can be used to
# give the user a detailed report on what went wrong during a parse.
#
class(Parslet) ErrorTree: {
# The parslet that caused the error stored here.
attr_reader(parslet)
# All errors that were encountered when parsing part of this +parslet+.
attr_reader(children)
def initialize:(parslet, *children) { # :nodoc:
@stormbrew
stormbrew / gist:863096
Created March 9, 2011 21:58
Benchmark of faster version of Hash#reject.
graham-battys-macbook:rubinius-master graham (perf-hash)$ bin/rbx benchmark/bin/benchmark -tx -tr benchmark/core/hash/bench_reject.rb
=== bin/rbx ===
reject string 91940.6 (±14.1%) i/s - 445500 in 5.020721s (cycle=2750)
reject numbers 220166.2 (±7.9%) i/s - 1092648 in 4.999565s (cycle=10308)
reject! string 94992.6 (±7.4%) i/s - 476934 in 5.052189s (cycle=5482)
reject! numbers 199148.9 (±6.9%) i/s - 995456 in 5.025582s (cycle=11312)
=== ruby ===
reject string 51115.8 (±12.1%) i/s - 252488 in 5.011600s (cycle=3412)
reject numbers 63331.0 (±12.9%) i/s - 311360 in 5.005070s (cycle=3892)
reject! string 98969.8 (±11.5%) i/s - 492195 in 5.039376s (cycle=5181)
class Z
end
class B
puts self, Z # => "B, Z"
end
class A
class Z; end
class ::B