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
| class A | |
| X = "A::X" | |
| Y = "A::Y" | |
| Z = "A::Z" | |
| end | |
| module B | |
| Y = "B::Y" | |
| class C < 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
| $ ruby-trunk -v benchmark_new.rb | |
| ruby 2.0.0dev (2012-04-18 trunk 35385) [i686-linux] | |
| Rehearsal ------------------------------------------ | |
| new 1.030000 0.000000 1.030000 ( 1.035411) | |
| color= 0.180000 0.000000 0.180000 ( 0.180050) | |
| --------------------------------- total: 1.210000sec | |
| user system total real | |
| new 1.010000 0.010000 1.020000 ( 1.008668) | |
| color= 0.180000 0.000000 0.180000 ( 0.181044) |
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
| require 'benchmark' | |
| require 'avl_tree' | |
| require 'red_black_tree' | |
| require 'immutable/map' | |
| require 'atomic' | |
| class LockBoundFib | |
| def initialize(map = RedBlackTree.new) | |
| @memo = map |
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
| class Root | |
| def foo | |
| puts "Root#foo" | |
| end | |
| end | |
| module M | |
| def foo | |
| super | |
| puts "M#foo" | |
| end |
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 M | |
| def foo | |
| p M | |
| super | |
| end | |
| alias bar foo | |
| end | |
| class Base |
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 FizzBuzzInteger | |
| refine Fixnum do | |
| def to_s | |
| self % 15 == 0 ? "FizzBuzz" : | |
| self % 5 == 0 ? "Fizz" : | |
| self % 3 == 0 ? "Buzz" : | |
| super | |
| end | |
| end | |
| end |
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
| CC = gcc | |
| LD = ld | |
| LDSHARED = gcc -shared | |
| CFLAGS = -O0 -g -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=implicit-function-declaration -ansi -std=iso9899:199409 | |
| XCFLAGS = -include ruby/config.h -include ruby/missing.h -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -fPIE | |
| CPPFLAGS = -I. -I.ext/include/i686-linux -I./include -I. | |
| DLDFLAGS = -fstack-protector -pie | |
| SOLIBS = | |
| compiling main.c | |
| In file included from ./include/ruby.h:33:0, |
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
| require "benchmark" | |
| N = 1000 | |
| class Foo | |
| def foo | |
| end | |
| end | |
| class Bar |
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
| diff --git a/vm_method.c b/vm_method.c | |
| index e44782c..bf02c2c 100644 | |
| --- a/vm_method.c | |
| +++ b/vm_method.c | |
| @@ -407,8 +407,10 @@ search_method(VALUE klass, ID id, VALUE omod, VALUE *defined_class_ptr) | |
| iclass = rb_hash_lookup(omod, klass); | |
| if (NIL_P(iclass) && BUILTIN_TYPE(klass) == T_ICLASS) { | |
| iclass = rb_hash_lookup(omod, RBASIC(klass)->klass); | |
| - if (!NIL_P(iclass)) | |
| + if (!NIL_P(iclass)) { |
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
| class Node { | |
| def eval(other: Node): Unit = other.protected_method(this) | |
| protected def protected_method(other: Node) = other | |
| } | |
| class NodeFake(node: Node) extends Node { | |
| override def eval(other: Node): Unit = { | |
| println("pre") | |
| println(this == other.protected_method(this)) |