Rubinius @ RubyAndRails2010

46
Rubinius Use Ruby

Transcript of Rubinius @ RubyAndRails2010

Page 1: Rubinius @ RubyAndRails2010

RubiniusUse Ruby

Page 3: Rubinius @ RubyAndRails2010
Page 4: Rubinius @ RubyAndRails2010

1.1 is out!

Page 5: Rubinius @ RubyAndRails2010

2006

Let’s have funand write a new

interpreter!

Page 6: Rubinius @ RubyAndRails2010

2006

1.0 by end 2007!

Page 7: Rubinius @ RubyAndRails2010

2007

Ok, maybe not...

Page 8: Rubinius @ RubyAndRails2010

2010

1.0!

Page 9: Rubinius @ RubyAndRails2010
Page 10: Rubinius @ RubyAndRails2010

2 virtual machines

Page 11: Rubinius @ RubyAndRails2010

2 virtual machines

1.75 garbage collectors

Page 12: Rubinius @ RubyAndRails2010

2 virtual machines

1.75 garbage collectors

3 bytecode compilers

Page 13: Rubinius @ RubyAndRails2010

2 virtual machines

1.75 garbage collectors

3 bytecode compilers

1 Ruby core library

Page 14: Rubinius @ RubyAndRails2010

2 virtual machines

1.75 garbage collectors

3 bytecode compilers

1 Ruby core library

2 primitives systems

Page 15: Rubinius @ RubyAndRails2010

2 virtual machines

1.75 garbage collectors

3 bytecode compilers

1 Ruby core library

2 primitives systems

2 JIT compilers

Page 16: Rubinius @ RubyAndRails2010

Rubyspec

Page 17: Rubinius @ RubyAndRails2010

Ruby in Ruby

Page 18: Rubinius @ RubyAndRails2010

module Enumerable def collect if block_given? ary = [] each { |o| ary << yield(o) } ary else to_a end end

alias_method :map, :collectend

Page 19: Rubinius @ RubyAndRails2010

What is Rubinius these days?

Page 20: Rubinius @ RubyAndRails2010

Compacting generational

garbage collector

Page 21: Rubinius @ RubyAndRails2010
Page 23: Rubinius @ RubyAndRails2010

class Address attr_reader :street attr_reader :number attr_reader :cityend

Address.instance_variable_get("@seen_ivars")=> [:@street, :@number, :@city]

Page 24: Rubinius @ RubyAndRails2010

a = Address.newa.street = "Street"a.number = "1"a.city = "Enschede"

Rubinius.memory_size(a) => 56

Rubinius.memory_size(a) => 160

VS

Page 25: Rubinius @ RubyAndRails2010

JIT

Page 26: Rubinius @ RubyAndRails2010

InlineCache

Page 27: Rubinius @ RubyAndRails2010

module CoolModule def method1 1 + 1 endend

class CoolObject include CoolModuleend

CoolObject.new.method1

Page 28: Rubinius @ RubyAndRails2010

Call counting

Page 29: Rubinius @ RubyAndRails2010

def method1 1 + 1end

def method2 method1end

100.times do method2end

Page 30: Rubinius @ RubyAndRails2010

members of rubinius::VMMethod: total_args = 0, call_count = 21, llvm_function_ = 0x0, name_ = 0x6306,

Page 31: Rubinius @ RubyAndRails2010

RBXthread(s)

Go JIT!

Here it is!

LLVMthread

Page 32: Rubinius @ RubyAndRails2010

Debugging

Page 33: Rubinius @ RubyAndRails2010

DEMO

Page 34: Rubinius @ RubyAndRails2010

Profiling

Page 35: Rubinius @ RubyAndRails2010

DEMO

Page 36: Rubinius @ RubyAndRails2010

Contributing

Page 37: Rubinius @ RubyAndRails2010

26

3 legged dog turtles space shuttle rubinius

Performance

Page 38: Rubinius @ RubyAndRails2010

commit 5386d9299360b5f1ede14392b97da6dc7163ed00Author: Dirkjan Bussink <[email protected]>Date: Tue Jan 8 20:29:01 2008 +0100

Added Process::POSIX safety checks

diff --git a/kernel/core/process.rb b/kernel/core/process.rbindex fec15b6..ff50b49 100644--- a/kernel/core/process.rb+++ b/kernel/core/process.rb@@ -103,11 +103,15 @@ module Process end def self.getpgid(pid)- Platform::POSIX.getpgid(pid)+ ret = Platform::POSIX.getpgid(pid)+ Errno.handle if ret == -1+ ret end def self.setpgid(pid, int)- Platform::POSIX.setpgid(pid, int)+ ret = Platform::POSIX.setpgid(pid, int)+ Errno.handle if ret == -1+ ret end @maxgroups = 32

Page 39: Rubinius @ RubyAndRails2010

1 patch == commit access

Page 40: Rubinius @ RubyAndRails2010

rbx my_awesome_code.rb

Page 41: Rubinius @ RubyAndRails2010

Future

Page 42: Rubinius @ RubyAndRails2010

1.9

Page 43: Rubinius @ RubyAndRails2010
Page 44: Rubinius @ RubyAndRails2010
Page 45: Rubinius @ RubyAndRails2010

DEMO

Page 46: Rubinius @ RubyAndRails2010

So when will you

be a contributor?