can you see me?ko1/activities/rubyconf2008_ko1.pdf · future of ruby vm. talk about ruby vm...

53
Can you see me? 2008/12/11 Future of Ruby VM - RubyConf2008 1

Upload: others

Post on 25-Aug-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Can you see me?

2008/12/11 Future of Ruby VM - RubyConf2008 1

Page 2: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Future of Ruby VMTalk about Ruby VM Performance.

Ruby VMの未来,とかなんとか

SASADA Koichi <[email protected]>Department of Creative Informatics,

Graduate School of Science and Technology,The University of Tokyo

2008/12/11 2Future of Ruby VM - RubyConf2008

Page 3: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Summary of My Talk

“Scaling Ruby (without the Rails)“ Seems Interesting!

“Monkeybars: easy cross platform GUIs” Also Does!

On My Performance Interesting,Former is Preferred ☺Anyone make a Log?

2008/12/11 Future of Ruby VM - RubyConf2008 3

Page 4: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Summary

CRuby/YARV isNOT a “BEST” Solution

for Ruby VM Performance.

However, CRuby/YARV is“GOOD” Enough Solution for Us, the Pragmatic Ruby Programmers,

at least Several Years.2008/12/11 Future of Ruby VM - RubyConf2008 4

Page 5: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Self IntroductionRecent Report about Me

ko1 - Koichi (Given Name) Sasada (Family Name)From Japan, 5th RubyConf since 2004, 4th SpeachYARV Developer

LecturerDepartment of Creative Informatics, Graduate School of Science and Technology, The University of Tokyo.Lecture: Programming System, but only 3 students attend

SASADA-labIf you want to research about Ruby or Virtual Machine, Systems Software in Japan, please contact me.2 students are there, but no one want to hack YARV.

2008/12/11 Future of Ruby VM - RubyConf2008 5

Page 6: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

6

Caution! (re-re-review)I canʼt speak English well

If I say strange English, you can see the slide page• Or ask another Japanese. They can speak English well.

• My Slides uses Small Characters (against Takahashi-sanʼs Presentation Method)

If you have any question, ask me with:• Japanese (recommended)• Ruby, C, Scheme, Java, …, Python, Haskell, ...• Or Easy English

2008/12/11 Future of Ruby VM - RubyConf2008

Page 7: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Agenda

Perspective of Ruby VM PerformanceVM Performance DiscussionOur Performance Policy

Introduction of Our ResearchHidden Optimization Techs.Ricsin ProjectRuby to C AOT Compiler Projectatomic-Ruby ProjectMVM Project

Summary2008/12/11 Future of Ruby VM - RubyConf2008 7

Page 8: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Remember The Evanʼs Classification

JRuby is for Java ProgrammersIronRuby is for .Net ProgrammersRubinius is for Ruby Programmers

CRuby is for C Programmers

2008/12/11 Future of Ruby VM - RubyConf2008 8

Page 9: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

OK.Letʼs Talk about the “C”,

The Benefits and Limitation

2008/12/11 Future of Ruby VM - RubyConf2008 9

Page 10: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Evolution of VM PerformanceMy Prediction

2008/12/11 Future of Ruby VM - RubyConf2008 10

Per

form

ance

Time / Effort / Money

CRuby

JRuby, IronRubyRubinius

We are here

???

Now, CRuby isGood one

CRuby hasLimitation

Finally, Rubiniusis Best for Ruby’s

Pefromance

Question:When get here?

Goodat First

Page 11: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Techniques for VM Performance

Simple Optimization TechniquesC-level VM Techniques

Advanced Optimization TechniquesDynamic Code Generation• Speed-up using Native Machine code Compiler• Just in Time Compilation• Polymorphic Inline Cache• Selective InliningOnline Feedback Optimization• HotSpot JIT Compiler• Tracing JIT

2008/12/11 Future of Ruby VM - RubyConf2008 11

Page 12: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Pros and Cons of JRuby/IronRuby

Using Awesome VMPros.

Many Clever People Working on each VMNo Code is Good Code.• No Bugs are Generated.Many Libraries on Each EnvironmentsEasy (?) to Use Parallelization

Cons.Not Only Focused on Ruby, Semantics GapCanʼt Use C Extensions Directly

2008/12/11 Future of Ruby VM - RubyConf2008 12

Page 13: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Pros and Cons of Rubinius

Most of Code is Written in RubyLike Java

Pros.Ruby in Ruby• Meta-Circular InterpreterBest Way to Improve Performance in the Long RunBecause They Can Analyze Most of Programs.Mainly Focus on Ruby

Cons.Long Way to Get High Performance VM

2008/12/11 Future of Ruby VM - RubyConf2008 13

Page 14: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Pros of “C” RubyPortability

Most of Environments have GCC Porting.Maintainability

Everyone Know C.Extensibility

Easy to Write Extension with C.Performance Improvement

Easy to Write Simple (Machine Independent) Optimization.

2008/12/11 Future of Ruby VM - RubyConf2008 14

Page 15: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Cons (Limitation) of “C” RubyC Extension Libraries or Methods written in C

GC Problem• Conservative Mark & Sweep Stop The World GC Inlining Problem• Canʼt Inline C code into Ruby CodeLimitation of Program Analysis

2008/12/11 Future of Ruby VM - RubyConf2008 15

Page 16: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Our Performance Policy

CRuby is Not “Best” Solution but “Good” OneContinue to Improve CRubyʼs Implementation

in Cin Machine Dependent Way

Pragmatic, Practical Selectionat least several years

2008/12/11 Future of Ruby VM - RubyConf2008 16

Page 17: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Keywords for Success

“Embedding”Parallelization

2008/12/11 Future of Ruby VM - RubyConf2008 17

Page 18: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Introduction of Our Research

To Take Advantage of “C”, Some Projects are Running

Hidden Optimization Techs on YARVRicsin: Mix-in C to Ruby ProjectRuby to C AOT Compiler Projectatomic-Ruby ProjectMulti-VM Project

2008/12/11 Future of Ruby VM - RubyConf2008 18

Page 19: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Hidden/Left Optimization Techs

Turned Off on 1.9.1 by DefaultTail call OptimizationOptimization using UnificationStack Caching

Left Easy OptimizationEfficient Method CachingEfficient Fiber Implementation using Platform dependent way such as makecontext()

These Optimizations will be Merged into 1.9.2

2008/12/11 Future of Ruby VM - RubyConf2008 19

Page 20: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Ricsin: Mix-in C to Ruby

Embed a part of C Program into RubyLike an RubyInline, but Embed DirectlyUsage Example

Use C Libs DirectlyReplace All Built-in Classes/MethodsTest Ruby C APIsPerformance Improvement Continuously

2008/12/11 Future of Ruby VM - RubyConf2008 20

Page 21: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Ricsin Notationdef open_fd(path) # Ruby

fd = __C__(%q{/* C */return INT2FIX(open(RSTRING_PTR(path), O_RDONLY));

})raise 'open error' if fd == -1yield fd

ensureraise 'close error' if -1 == __C__(%q{

/* C */return INT2FIX(close(FIX2INT(fd)));

})end

2008/12/11 Future of Ruby VM - RubyConf2008 21

Page 22: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Ricsin Total View

2008/12/11 Future of Ruby VM - RubyConf2008 22

rcb File(Ruby+C)

RicsinTranslator

Makefile C File(C)

C Build Env.(C compiler, etc)

so File(C Extension)

rb File(Ruby)

Ricsin-VerCRubyNeeded for Execution

Load/Exec

Page 23: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

RicsinTranslation and Execution

2008/12/11 Future of Ruby VM - RubyConf2008 23

/* A Part of Generated C Source */#define v (cfp->lfp[3])#define r (cfp->lfp[2])VALUE ricsin_func_1(

rb_control_frame_t *cfp){

const VALUE self = cfp->self;{

/* Embed C Body */rb_p(self);return INT2FIX(FIX2INT(v) + 1);

}return Qnil;

}#undef v#undef r

# rcbv = 42r = __C__(%q{/* Embed C Body */rb_p(self); /* show “main” */return INT2FIX(FIX2INT(v) + 1);

})p r #=> show “43”

[ADDR] [INSN] [OPERAND]0000 putobject 420002 setlocal v0004 opt_call_ricsin <funcptr>0006 setlocal r0008 putnil0009 getlocal r0011 send :p, 10017 leave

Generate

Bytecode Compile Function Call

Built to Extension Library

Page 24: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Ricsin: Evaluation

Performance Evaluation (Not a Usability)Evaluation Environment

Env.1:Intel Xeon E5335, LinuxEnv.2:SPARC T2, SunOS 5.10

Evaluation Items1. Calling C Function (null call)2. Example on Iterator3. Matrix Multiprior

2008/12/11 Future of Ruby VM - RubyConf2008 24

Page 25: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

RicsinEvaluation of Calling Null Function

C (sec) Ricsin (sec) C/RicsinEnv.1(Intel)

0.44 0.05 8.8

Env.2(SPARC)

4.56 0.44 10.4

2008/12/11 Future of Ruby VM - RubyConf2008 25

Calling Null C FunctionNull C MethodNull __C__ Embed

Page 26: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

RicsinEvaluation: Iterator Optimization

2008/12/11 Future of Ruby VM - RubyConf2008 26

Env.2 (SPARC)Env.1 (Intel)

Rewrite Iterators with RicsinC: Current IteratorRicsin: Rewriting with __Ccont__Ruby: Rewriting with Pure Ruby

Page 27: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

RicsinEvaluation: Matrix Multiplier

Matrix Multiplier with Fixnum ElementsReplace 12 Lines Ruby Code to 36 Lines C Code Directly

2008/12/11 Future of Ruby VM - RubyConf2008 27

Ruby (sec) Ricsin (sec) Ruby/RicsinEnv.1(Intel)

10.57 0.57 20.33

Env.2(SPARC)

85.31 6.73 12.68

Page 28: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Ricsin

svn cohttp://svn.ruby-lang.org/

repos/ruby/branches/ricsin

2008/12/11 Future of Ruby VM - RubyConf2008 28

Page 29: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Ruby to C AOT Compiler

Translate Ruby Script to C Source Code at Ahead of Time

Compile Ruby to BytecodeTranslate Bytecode to C Source Code

Performance Improvement byEliminate VM Instruction DispatchOptimization by C CompilerEliminate Parse/Compile Time

2008/12/11 Future of Ruby VM - RubyConf2008 29

Page 30: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Ruby to C AOT Compiler

Ahead of Time Compilation1. Compile Ruby Script to VM Bytecode2. VM Bytecode to C

AOT compiler

Csource codeNative code C

compiler

Ruby script VM Bytecode

2008/12/11 30Future of Ruby VM - RubyConf2008

Page 31: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Execution with Ruby VM

Ruby to C AOT Compiler

evaled String

VM

VM InsnsNative code(AOTed)

Ruby script

Extensionwritten in C

2008/12/11 31Future of Ruby VM - RubyConf2008

Page 32: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Evaluation EnvironmentEnv CPU Memory OS C Compiler

32bit Linux

Intel PentiumD2.80GHz 2 GB Linux

2.6.24 gcc 4.2.3

64bitLinux

Intel Xeon 3060 2.40GHz 1 GB Linux

2.6.18 gcc 4.1.2

cygwinIntel Core Duo

U2400 1.06GHz

1.5 GB Windows Vista SP1 gcc 3.4.4

PS3

Cell Broadband

Engine3.2GHz

256 MB Linux2.6.16 gcc 4.1.1

2008/12/11 32Future of Ruby VM - RubyConf2008

Page 33: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Ruby to C AOT CompilerEvaluation Results

5.26

1.66 1.44

5.17

1.38 1.26

3.40

1.46 1.02

2.85

1.34 1.36

0

1

2

3

4

5

6

while loop fibonacci number pentomino

32bit Linux64bit LinuxcygwinPS3

2008/12/11 33Future of Ruby VM - RubyConf2008

Spe

edup

Rat

io

Page 34: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Related Work

ruby2c by Eric, RyanSubset Ruby to C

yajit by ShinhJIT (yarv bytecode to IA-32 with Xbyak)

yarv2llvm by Miura-sanJIT (yarv bytecode to LLVM asm)

2008/12/11 Future of Ruby VM - RubyConf2008 34

Page 35: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

atomic-Ruby Project

Issue: Ruby is too FatInvolves Convenient Functions.Complex and Rational will be Built-in at Ruby 1.9

→ Difficult to Use “Embedded” Environment“Embedded”

Embedded System such as Resource Limitation Devs.• In Many Case, Numeric Tower or m17n are not needed.Application Embedded Ruby• Application needs “DSL Engine”, doesnʼt Full-set Ruby

2008/12/11 Future of Ruby VM - RubyConf2008 35

Page 36: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

atomic-Ruby Project (cont.)We Need Slim Ruby Interpreteratomic-Ruby makes “Suitable Ruby Interpreter”

Ruby Interpreter for ApplicationRuby Interpreter for Environment (such as Embedded Systems)Ruby Interpreter for Driver Application

Utilize CRubyʼs Portability3 Sub-Project with 3 Students

Plug-in/out Built-in Classes/MethodsPre-Compilation and Remove Parser/CompilerSwitch Core-Feature such as GC, Regex, Thread, etc

2008/12/11 Future of Ruby VM - RubyConf2008 36

Page 37: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

atomic-RubyIncremental GC

Switch GC AlgorithmMark Partially

Execute App and Mark partiallyReduce Application Stop Time

Start GC

Application

GC

Finish GC

372008/12/11 Future of Ruby VM - RubyConf2008

Page 38: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Auto Write Barrier Detection

Write Barrier is Needed for Several GC Algorithms.

Need Interpreter and Extensions.Need Special Knowledge of VM and GC.Cause Critical Bugs if WB Insertion Miss.

Automatically WB Detection System

38

RubyVM

WBWB

WB WB

WB

ExtensionExtension

ExtensionWB

WB

2008/12/11 Future of Ruby VM - RubyConf2008

Page 39: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Snapshot (Real Time) GC

Stop Time of Application (Mark Phase)Insert Many WBs.

39

0

20

40

0 10 20 30 40 50 60 70

スナップショットGC

従来のGC

Stop Tim

e[m

s]

Heap Size [KB]

Snapshot GCCurrent GC

2008/12/11 Future of Ruby VM - RubyConf2008

Page 40: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

By The Way,Other CRuby GC Related Projects

Generational GC (Kiyama)1 bit Reference Count GC (Matz)Floating as Special Constant (ko1)Lazy Sweep (autherNari)Bitmap GC (Enterprise Ruby, autherNari)Mostly Copying GC (Ugawa)

2008/12/11 Future of Ruby VM - RubyConf2008 40

Page 41: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Multi-VM (MVM) Project

Multi Virtual Machine in One ProcessEach VMs are able to run in Parallel

Each VMs have Giant VM Lock.High Speed Inter-VM Communication

Inner Process Communication

2008/12/11 Future of Ruby VM - RubyConf2008 41

Page 42: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Multi-VM Overview

42

Ruby (YARV)

Native ThreadSystem S/W

Processor(s)PE PE PE・・・

H/W

RT RT RT

NT NT NT

Thread SchedulerS/W

PE: Processor Element, UL: User Level, KL: Kernel Level

・・・

・・・

VM1 VM2

Page 43: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Multi-VM (MVM) Project

Sponsored bySun Microsystems, Inc.

Nobu (a.k.a Patch Monster)is Working for This Project

2008/12/11 Future of Ruby VM - RubyConf2008 43

Page 44: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

MVM

svn cohttp://svn.ruby-lang.org/

repos/ruby/branches/mvm

2008/12/11 Future of Ruby VM - RubyConf2008 44

Page 45: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Summary

CRuby/YARV isNOT “BEST” Solutuin

for Performance.

However, CRuby/YARV is“GOOD” Solution for Us,

the Pragmatic Ruby Programmers,at least Several Years.

2008/12/11 Future of Ruby VM - RubyConf2008 45

Page 46: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Summary (cont.)

CRuby is Enable to Evolve MoreoverSome Projects to Take advantage of CRuby

Ricsin: mix-in C to Ruby ProjectRuby to C AOT Compiler Projectatomic-Ruby ProjectMulti-VM Project

2008/12/11 Future of Ruby VM - RubyConf2008 46

Page 47: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Fin.

Thank You for Your Attention.Any Questions?

SASADA Koichi<[email protected]>

Department of Creative Informatics,Graduate School of Science and Technology,

The University of Tokyo

2008/12/11 Future of Ruby VM - RubyConf2008 47

Page 48: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

2008/12/11 Future of Ruby VM - RubyConf2008 48

Page 49: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

Accepted Method:Ruby Thread and Native Thread (1:1) ← Ruby 1.9/YARV

49

Ruby (YARV)

Native ThreadSystem S/W

Processor(s)PE PE PE・・・

H/W

RT RT RT

NT NT NT

Thread SchedulerS/W

PE: Processor Element, UL: User Level, KL: Kernel Level

・・・

・・・

Page 50: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

EvaluationResult (Micro-benchmark)

50

x 7.4w/8 Cores

Page 51: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

DiscussionHow to Embed 64 bit Double?

51

VALUE embed Object doesnʼt need memory overhead64bit CPU have 64 bit pointer type→ Use 64 bit CPUAt least we need 1 bit for TAG bit

From Mantissa?• Decrease PrecisionFrom Exponential?• Decrease Representation Range

Page 52: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

EvaluationToy-Program

52

Reduce Mem TimeEncode/Decode don’taffect to Performance

Page 53: Can you see me?ko1/activities/rubyconf2008_ko1.pdf · Future of Ruby VM. Talk about Ruby VM Performance. Ruby VMの未来,とかなんとか. SASADA Koichi  Department

EvaluationCompared with other Ruby Impl.

53From Comp. Lang. Shootout [4]