Skip to content

Instantly share code, notes, and snippets.

View brixen's full-sized avatar

Brian Shirai brixen

View GitHub Profile
gauss:rubinius brian$ rm -rf rdoc-output; time bin/rbx -S rdoc --all --force-update --threads=1 --output rdoc-output benchmark/app/rdoc-2.4.3/lib > rdoc.txt
Generating Darkfish...
real 1m0.413s
user 0m56.823s
sys 0m0.702s
gauss:rubinius brian$ cat rdoc.txt | grep 'size 0' | wc -l
51796
gauss:rubinius brian$ cat rdoc.txt | grep 'size 1' | wc -l
ALIAS
AND
ARGS
ARGSCAT
ARGSPUSH
ARRAY
ATTRASGN
BACK_REF
BEGIN
BLOCK
An exception occurred running /home/brixen/devel/rubinius/bin/rails
Unable to read string (PrimitiveFailure)
Backtrace:
MemoryPointer#read_string_length at kernel/platform/memorypointer.rb:155
MemoryPointer#read_string at kernel/platform/memorypointer.rb:165
Iconv#get_success at /home/brixen/devel/rubinius/lib/iconv.rb:122
Iconv#iconv at /home/brixen/devel/rubinius/lib/iconv.rb:219
Iconv#close at /home/brixen/devel/rubinius/lib/iconv.rb:76
Iconv.open at /home/brixen/devel/rubinius/lib/iconv.rb:90
if true
a = 1
else
a = 2
end
p a
sup = Class.new do
def a; "a"; end
def b; "b"; end
end
sub = Class.new(sup) do
[:a, :b].each do |name|
define_method name do
super()
end
11:57 nicksieger >> compile time to get the field names, yes
11:57 evan >> well sort of
11:57 evan >> i'd like that to work
11:57 nicksieger >> assuming they don't change betw. platforms
11:58 evan >> but it doesn't work all the time
11:58 wycats >> evan: in what case doesn't it work?
11:58 evan >> some platforms put fields of different names in structs
11:58 brixen >> yep
11:58 wycats >> wot
11:58 evan >> sounds stupid, but it happens
$ bin/rbx -Xprofiler.graph -r timeit -e 'require "melbourne"; require "profile"; timeit { ast = File.to_ast "lib/ruby_parser.rb"; c = Compiler.new(Compiler::Generator); node = Compiler::Node::Script.new(c); node.body = ast; node.to_description(:__script__) }'
18.229345
index % time self children called name
----------------------------------------------------------
0.00 17.52 4642/7722 Compiler::Generator#find_literal [43]
[1] 2.9 6.02 11.50 4642 Array#index [1]
1.01 0.00 8305023/8364281 Array::Iterator#next [5]
0.96 0.00 8301943/8340385 Array::Iterator#item [6]
3.00 12.46 5205490/5586425 String#== [2]
0.28 13.42 709631/709631 Fixnum#== [10]
class Object
def hash_class
RBXHash
end
end
gauss:rubinius brian$ cat hash.rb
Undefined = Object.new
class Type
def self.coerce_to obj, klass, method
r = obj.send method
def fib(n)
return n if n < 2
fib(n-1) + fib(n-2)
end
Benchmark.bm do |x|
x.report { fib 40 }
end
Running all benchmarks in benchmark/app
Writing report to benchmark/results/rbx-jit-03-09-2009-0405.yaml
Running bm_gem_install_local.rb
rbx: vm/external_libs/llvm/include/llvm/Instructions.h:723: llvm::ICmpInst::ICmpInst(llvm::CmpInst::Predicate, llvm::Value*, llvm::Value*, const llvm::Twine&): Assertion `getOperand(0)->getType() == getOperand(1)->getType() && "Both operands to ICmp instruction are not of the same type!"' failed.
sh: line 1: 17927 Aborted rbx -Xjit.enabled -S gem install --local --install-dir rdoc-gem-local --bindir rdoc-gem-local --no-rdoc --no-ri --ignore-dependencies rdoc-2.4.3.gem
rbx: vm/external_libs/llvm/include/llvm/Instructions.h:723: llvm::ICmpInst::ICmpInst(llvm::CmpInst::Predicate, llvm::Value*, llvm::Value*, const llvm::Twine&): Assertion `getOperand(0)->getType() == getOperand(1)->getType() && "Both operands to ICmp instruction are not of the same type!"' failed.
sh: line 1: 17932 Aborted rbx -Xjit.enabled -S gem install --local --install-dir