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
#!/usr/bin/env ruby | |
require 'benchmark' | |
length = 512 | |
iterations = 100000 | |
encodings = Encoding.name_list | |
Benchmark.bmbm do |r| | |
r.report("encode") do |
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
gem 'rails', '~>4.0.2' | |
gem 'rubysl', :platforms => [:rbx] | |
gem 'racc', :platforms => [:rbx] |
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
#!/usr/bin/env ruby | |
# | |
# This is a proof-of-concept script to build every commit of ruby over the past | |
# year and store all of the resulting builds in git. The purpose of using git | |
# for storage is to take advantage of its de-duplication and compression | |
# features. | |
# | |
# Requirements: | |
# - git |
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
(gdb) t a a bt | |
Thread 5 (process 11796): | |
#0 0x00000001003d8e4f in llvm::SelectionDAG::getFrameIndex () | |
#1 0x000000010027d55b in (anonymous namespace)::X86DAGToDAGISel::getAddressOperands () | |
#2 0x000000010027da18 in (anonymous namespace)::X86DAGToDAGISel::SelectAddr () | |
#3 0x000000010027a78c in (anonymous namespace)::X86DAGToDAGISel::CheckComplexPattern () | |
#4 0x000000010043994c in llvm::SelectionDAGISel::SelectCodeCommon () | |
#5 0x0000000100274536 in (anonymous namespace)::X86DAGToDAGISel::Select () | |
#6 0x000000010043bc41 in llvm::SelectionDAGISel::DoInstructionSelection () |
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
#!/usr/bin/env ruby | |
string = "\n\v" | |
puts "before racc require: #{Array(string).inspect}" | |
require 'racc' | |
puts "after racc require: #{Array(string).inspect}" |
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
#!/usr/bin/env ruby | |
class BadString < String; end | |
original = (0..255).to_a.pack("C*").force_encoding("UTF-8") | |
subclass = BadString.new(original) | |
round_tripped = subclass.to_s | |
puts "encoding: original = #{original.encoding}, subclass = #{subclass.encoding}, round_tripped = #{round_tripped.encoding}" | |
puts "valid_encoding? original = #{original.valid_encoding?}, subclass = #{subclass.valid_encoding?}, round_tripped = #{round_tripped.valid_encoding?}" |
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 A | |
def foo | |
puts "foo from A" | |
end | |
end | |
class B | |
include A | |
def foo |
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
#!/usr/bin/env ruby | |
puts "Run this in another terminal:" | |
puts "" | |
puts " sudo ./trace-gc-standalone.sh #{$$}" | |
puts "" | |
puts "... wait for the 'Ready!' message, switch back here and press enter to start." | |
GC::Profiler.enable | |
$stdin.gets |
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
#!/usr/bin/env ruby | |
t0 = Time.now | |
GC::Profiler.enable | |
100000.times do | |
String.new('a' * 1000) | |
end | |
gc_time = GC::Profiler.total_time |
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
#!/usr/bin/env ruby | |
require 'thread' | |
require 'rubygems' | |
require 'monitor' | |
class Dummy | |
include MonitorMixin | |
def sync |