Created
April 30, 2015 14:40
-
-
Save chrisseaton/7ead01c76ba04e0b987f to your computer and use it in GitHub Desktop.
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
module Foo | |
extend self | |
def foo(a, b, c) | |
hash = {a: a, b: b, c: c} | |
array = hash.map { |k, v| v } | |
x = array[0] | |
y = [a, b, c].sort[1] | |
x + y | |
end | |
end | |
class Bar | |
def method_missing(method, *args) | |
if Foo.respond_to?(method) | |
Foo.send(method, *args) | |
else | |
0 | |
end | |
end | |
end | |
bar = Bar.new | |
loop do | |
start = Time.now | |
1_000_000.times do | |
# This block should be compiled to the constant Fixnum value 22 | |
bar.foo(14, 8, 6) | |
end | |
puts Time.now - start | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment