Skip to content

Instantly share code, notes, and snippets.

View brixen's full-sized avatar

Brian Shirai brixen

View GitHub Profile
*.rbc
*.pyc
# Original blog post about Rubinius performance on the alioth mandelbrot benchmark:
# http://rfc2616.wordpress.com/2010/10/16/rubinius-vs-the-benchmark-from-hell/
#
# Problems with assumptions in the blog post:
# * The C <-> Ruby comparison is apples to oranges because the Ruby code
# is written to use blocks rather than loops. That imposes the overhead
# of additional execution contexts per pixel.
# * The output is written a byte at a time, which requires a fairly deep
# chain of methods before the byte is handed off to the OS.
# * The work is done in the script body. Unless the implementation has
def stat(args)
p :stat => args
end
def xtest(number)
p "number is: #{number}"
return false if number == 3
return true
end
require "benchmark"
N = (ARGV.shift || 40).to_i
def fib(n)
return n if n < 2
fib(n-2) + fib(n-1)
end
Benchmark.bmbm do |x|
# eager loading
$ bin/rbx -Xint -r rubinius/analyst -e 'puts Rubinius::Analyst.new.itemized_memory'
Young: 6.0M
Mature: 10.0M
Large: 751.7K
Code: 2.9M
Symbols: 89.6K
Total: 19.7M
@headius
headius / gist:961054
Created May 8, 2011 02:41
invokedynamic example in BiteScript
import java.lang.invoke.MethodHandle
import java.lang.invoke.MethodType
import java.lang.invoke.CallSite
import java.lang.invoke.ConstantCallSite
import java.lang.invoke.MethodHandles::Lookup
JClass = java.lang.Class
# Our main method, which does one invokedynamic
main do
# handle for our bootstrap, which binds invokedynamic to a CallSite
sasha:rubinius2.0 brian$ rbx
irb(main):001:0> o = Object.new
=> #<Object:0xf30>
irb(main):002:0> sc = Rubinius::Type.object_singleton_class(o)
=> #<Class: #<Object:3888>>
irb(main):003:0> module N
irb(main):004:1> def foo; puts 'foozee'; end
irb(main):005:1> end
=> #<Rubinius::CompiledMethod foo file=(irb)>
irb(main):007:0> sc.send :include,
1)
ConditionVariable#wait returns self ERROR
WeakRef::RefError: Object has been collected as garbage
WeakRef#object at kernel/bootstrap/weakref.rb:22
{ } in ThreadGroup#add at kernel/common/thread_group.rb:12
Array#delete_if at kernel/common/array.rb:716
ThreadGroup#add at kernel/common/thread_group.rb:12
Thread#initialize at kernel/bootstrap/thread.rb:152
Thread.new at kernel/bootstrap/thread.rb:95
{ } in Object#__script__ at spec/ruby/library/conditionvariable
@max-mapper
max-mapper / readme.md
Created September 28, 2011 02:01
SLEEP - syncable.org

Your API does REST, but can it SLEEP?

SLEEP (Syncable Lightweight Event Emitting Persistence) is an emerging standard for distributed data sync using HTTP and JSON. A generalized version of CouchDB's much lauded built-in replication, SLEEP extends the REST architecture to define a way in which databases can offer syncable JSON APIs that foster open data innovation by allowing developers to replicate entire databases over the net.


SLEEP comes from the Apache CouchDB project which is now widely known for it's multi-master streaming HTTP + JSON replication. This is possible in part because of the CouchDB _changes feed, which is a particular API that lets you see if there have been any changes made to the database since last time you synchronized. CouchDB can efficiently implement the _changes feed because of one subtle difference between it and most other databases: it stores a history of all changes that happen to the database, including deletes.

If you synchronize data from a remote source and then the

diff --git a/vendor/onig/Makefile.am b/vendor/onig/Makefile.am
index b4b2ea4..670d058 100644
--- a/vendor/onig/Makefile.am
+++ b/vendor/onig/Makefile.am
@@ -5,6 +5,7 @@ libname = libonig.la
#AM_CFLAGS = -DNOT_RUBY
AM_CFLAGS =
+ACLOCAL_AMFLAGS = -I m4
INCLUDES = -I$(top_srcdir) -I$(includedir)