This file contains 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
#https://gist.github.com/709860 | |
require 'benchmark' | |
# does Benchmark::bmbm have environments/setup like Test::Unit | |
# want some variables to be set per benchmark case - now have to dup them myself | |
# is is needed as the testcases have destructive operations, otherwise the testcases will be dependent on each other | |
larger_benchmark = Proc.new do |benchmark| | |
big = (1..95).to_a |
This file contains 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
#https://gist.github.com/709860 | |
require 'benchmark' | |
# does Benchmark::bmbm have environments/setup like Test::Unit | |
# want some variables to be set per benchmark case - now have to dup them myself | |
# is is needed as the testcases have destructive operations, otherwise the testcases will be dependent on each other | |
def benchmark_setup(obj=TOP_SELF) | |
code = <<-CODE |
This file contains 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
# How does work? | |
# at top-level: | |
Hello #=> :hello | |
class Friend | |
puts Hello | |
end | |
#=> NameError: uninitialized constant Friend::Hello |
This file contains 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: Color | |
type: enum | |
description: Encapsulates an abstract color. Contains a large list | |
of different colors which can be accessed like: | |
Color.Russet |
This file contains 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
/* (c) 2010 John Mair (banisterfiend), Asher (Asher), MIT license */ | |
#include "compat.h" | |
#include "ruby.h" | |
VALUE | |
rb_prepend_methods(VALUE klass) | |
{ | |
VALUE m = rb_module_new(); | |
st_free_table(RCLASS_M_TBL(m)); |