Skip to content

Instantly share code, notes, and snippets.


Brian Shirai brixen

View GitHub Profile
View gist:146297
gauss:rubinius brian$ rm -rf rdoc-output; bin/rbx -P -Xprofiler.graph -S rdoc --all --force-update --threads=1 --output rdoc-output benchmark/app/rdoc-2.4.3/lib
Parsing sources with 1 thread(s)...
100% [59/59] benchmark/app/rdoc-2.4.3/lib/rdoc.rb
Generating Darkfish...
Files: 59
Classes: 120
Modules: 14
Methods: 723
View gist:146770
gauss:rubinius brian$ bin/rbx -r melbourne
irb(main):001:0> "".to_ast
=> "Hello from down under"
View gist:147085
gauss:rubinius brian$ bin/rbx -r melbourne
irb(main):001:0> "a =".to_ast
SyntaxError: (eval):1: syntax error, unexpected $end
from String#to_ast at /Users/brian/devel/rubinius/lib/melbourne.rb:10
from Object# (__eval__) at (irb):1
View gist:147153
* Read doc/experiments/hash/results.txt and use the methodology below
* Write benchmarks for Array#sort
* Use a sensible set of Array sizes from 10 to 10,000
* For each size, provide a) random Fixnum values, b) semi-random, c) semi-sorted
* Define what semi-random and semi-sorted mean quantitatively
* Follow the Hash example and generalize the Array rubyspecs to use new_array
* Research and Implement a) bottom-up heap sort, b) mergesort, c) in-place mergesort
* Document the algorithms and the papers referred to
* Run the implementations against the specs
* Run the implementations against the benchmarks for both interpreted only and JIT
View gist:147251
# Most of this can parse without modification, and be post-processed by compiler
import java.util.ArrayList
import java.lang.Runnable
class_attributes :name => 'foo'
class MyClass < ArrayList
implements Runnable
implements Serializable
# the arg syntax here is nonstandard, but similar to MacRuby and Duby
View gist:148056
irb(main):001:0> timeit { File.to_ast "lib/ruby_parser.rb" }
=> nil
irb(main):002:0> timeit { File.to_ast "lib/ruby_parser.rb" }
=> nil
irb(main):003:0> timeit { File.to_ast "lib/ruby_parser.rb" }
=> nil
irb(main):004:0> timeit { File.to_ast "lib/ruby_parser.rb" }
View gist:149629
gauss:rubinius brian$ bin/rbx -r melbourne -r timeit -e 'timeit { i = 0; while i < 13158; a = :"aooentuhr#{i}"; i+=1; end }'
gauss:rubinius brian$ bin/rbx -r melbourne -r timeit -e "timeit { i = 0; while i < 13158; a ='asentuhasesaearoeduarceduasodheuasoeudalrcdl9a8.lrcoduaosetudalroeudasoehtduasohtdeu'); i+=1; end }"
gauss:rubinius brian$ bin/rbx -r melbourne -r timeit -e "timeit { i = 0; while i < 13158;
'asentuhasesaearoeduarceduasodheuasoeudalrcdl9a8.lrcoduaosetudalroeudasoehtduasohtdeu'.to_ast; i+=1; end }"
gauss:rubinius brian$ bin/rbx -r melbourne -r timeit -e "timeit { i = 0; while i < 13158;; i+=1; end }"
View gist:150437
From 53a0ff5a8db607cba49dab1fb26e06ec82434f08 Mon Sep 17 00:00:00 2001
From: Brian Ford <>
Date: Sun, 19 Jul 2009 10:00:09 -0700
Subject: [PATCH] Reworked capi cached handles management.
Handles are persistent references to managed-memory objects (i.e.
"Ruby" objects). Objects that have handles are kept alive either
by the handle having a greater than 0 reference count, or the object
being reachable from another object.
View gist:150726
# This script provides a place to insert a potentially platform-specific
# method of monitoring a benchmark and possibly aborting the run if it
# exceeds a specified time limit. See README for more details.
def write_status(name, report, status) report, "a" do |f|
f.puts "---"
f.puts "name: #{name}"
f.puts "status: #{status}"
View gist:150849
gauss:rubinius brian$ ps ux | grep rbx
brian 34400 78.3 0.8 632984 33192 s004 R+ 12:49PM 0:07.13 rbx -S rdoc --all --force-update --threads=1 --output rdoc-output rdoc-2.4.3/lib
brian 34395 0.1 0.3 613456 13480 s004 S+ 12:49PM 0:00.17 rbx /Users/brian/devel/rubinius/benchmark/utils/bench.rb benchmark/app/bm_rdoc.rb 5 /Users/brian/devel/rubinius/benchmark/results/rbx-no-jit-20-07-2009-1249.yaml
brian 34394 0.0 0.0 600172 624 s004 S+ 12:49PM 0:00.00 sh -c rbx /Users/brian/devel/rubinius/benchmark/utils/bench.rb benchmark/app/bm_rdoc.rb 5 /Users/brian/devel/rubinius/benchmark/results/rbx-no-jit-20-07-2009-1249.yaml > /dev/null
brian 34393 0.0 0.0 600736 336 s004 S+ 12:49PM 0:00.00 ruby /Users/brian/devel/rubinius/benchmark/utils/monitor.rb 15 rbx /Users/brian/devel/rubinius/benchmark/utils/bench.rb benchmark/app/bm_rdoc.rb 5 /Users/brian/devel/rubinius/benchmark/results/rbx-no-jit-20-07-2009-1249.yaml
brian 34392 0.0 0.0 600736 1284 s004 S+ 12:49PM 0:00.
You can’t perform that action at this time.