<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Gray Soft / The Ruby VM Interview</title>
  <id>tag:graysoftinc.com,2014-03-20:/categories/11</id>
  <updated>2014-04-04T21:36:08Z</updated>
  <link rel="self" href="http://graysoftinc.com/the-ruby-vm-interview/feed.xml"/>
  <link rel="alternate" href="http://graysoftinc.com/the-ruby-vm-interview"/>
  <author>
    <name>James Edward Gray II</name>
  </author>
  <entry>
    <title>The Ruby VM:  Episode V</title>
    <link rel="alternate" href="http://graysoftinc.com/the-ruby-vm-interview/the-ruby-vm-episode-v"/>
    <id>tag:graysoftinc.com,2007-08-03:/posts/35</id>
    <updated>2014-04-04T21:36:08Z</updated>
    <summary>In this interview, Koichi takes us down the rabbit hole of Ruby optimizations.  He gives us quite a few things to look forward to in future releases.</summary>
    <content type="html">&lt;p&gt;&lt;strong&gt;You have told us before that one of the big reasons to move to a new Ruby VM was to provide new options for optimization.  Can you talk a little about the optimizations you have added to the new Ruby VM thus far and what operations will likely be faster because of them?&lt;/strong&gt;&lt;/p&gt;

&lt;dl&gt;
&lt;dt&gt;
&lt;strong&gt;ko1&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
        OK.  At first, I write about basic of YARV instruction.  YARV
        has two type instructions.  First is primitive instruction.
        It's as written, &lt;strong&gt;primitive&lt;/strong&gt;.  Ruby code can be
        represented in these primitive instruction.  Second is
        instructions for optimization.  It's not needed to represent
        Ruby scripts, but they are added for optimization.  Primitive
        instructions doesn't include &lt;code&gt;_&lt;/code&gt; in their name (like
        &lt;code&gt;putobject&lt;/code&gt;), and optimize instructions do (like
        &lt;code&gt;opt_plus&lt;/code&gt;). This policy helps you if you want to
        see VM instructions. Initially, you need to read primitive
        instructions.
    &lt;/p&gt;

    &lt;p&gt;
        The most easy and effective optimization is Specialized
        Instructions.  This optimization replace method call with
        another VM instruction, such as &lt;code&gt;Fixnum#+&lt;/code&gt; to
        &lt;code&gt;opt_plus&lt;/code&gt;. Current Ruby's numeric calculation is slow
        because all operations are method call.  For example, &lt;code&gt;1 + 2&lt;/code&gt;
        means &lt;code&gt;1.+(2)&lt;/code&gt;.  But numeric operations are more lightweight
        than Ruby's method invocation.  So method call is only overhead for
        numeric operation.  Specialized Instructions allow the VM to skip
        method call overhead.
    &lt;/p&gt;

    &lt;p&gt;
        But we can't know which expression is numeric operation or not
        at compile time.  See this expression: &lt;code&gt;a = c ? 1 : [:elem]&lt;/code&gt;,
        &lt;code&gt;a&lt;/code&gt; will be &lt;code&gt;Fixnum&lt;/code&gt; or &lt;code&gt;Array&lt;/code&gt;
        at runtime.
    &lt;/p&gt;

    &lt;p&gt;
        So, we can't replace &lt;code&gt;+&lt;/code&gt; expression with numeric operation
        instruction.  Specialized Instruction, for example &lt;code&gt;opt_plus&lt;/code&gt;
        which is replaced with &lt;code&gt;+&lt;/code&gt; method invocation will do
        following code:
    &lt;/p&gt;
    
    &lt;div class="highlight highlight-ruby"&gt;&lt;pre&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;opt_plus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;recv&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;val&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# simple version&lt;/span&gt;
   &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;recv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="no"&gt;Fixnum&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;val&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="no"&gt;Fixnum&lt;/span&gt;
     &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="no"&gt;Fixnum&lt;/span&gt;&lt;span class="c1"&gt;#+ is not redefined&lt;/span&gt;
       &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;calculate&lt;/span&gt; &lt;span class="s2"&gt;"recv + val"&lt;/span&gt; &lt;span class="n"&gt;without&lt;/span&gt; &lt;span class="nb"&gt;method&lt;/span&gt; &lt;span class="n"&gt;call&lt;/span&gt;
     &lt;span class="k"&gt;end&lt;/span&gt;
   &lt;span class="k"&gt;end&lt;/span&gt;
   &lt;span class="c1"&gt;# normal method invocation&lt;/span&gt;
   &lt;span class="n"&gt;recv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;+&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;val&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

    &lt;p&gt;
        Check receiver and value are &lt;code&gt;Fixnum&lt;/code&gt; or not, and check
        &lt;code&gt;Fixnum#+&lt;/code&gt; are not redefined.  After these check, calculate
        them without method invocation.  In fact, Float#+ are also checked.
        There are other specialized instructions.
    &lt;/p&gt;

    &lt;p&gt;
        YARV eases to implement such instructions with VM generator.
        You shouldn't write bothersome code such as stack
        manipulation.  If you write VM instruction such as &lt;code&gt;opt_plus&lt;/code&gt;
        in simple VM DSL, VM generator will translate it to C code.
    &lt;/p&gt;

    &lt;p&gt;
        Specialized Instruction is very simple, but effective for
        simple benchmark such as &lt;code&gt;fib()&lt;/code&gt; or &lt;code&gt;tak()&lt;/code&gt;
        and some calculate bound program.
    &lt;/p&gt;
  &lt;dd&gt;
&lt;/dd&gt;
&lt;/dd&gt;
&lt;/dl&gt;&lt;p&gt;&lt;strong&gt;One question I thought of while reading your previous answer was:  will Ruby scripts be able to access these VM instructions, if desired?&lt;/strong&gt;&lt;/p&gt;

&lt;dl&gt;
&lt;dt&gt;
&lt;strong&gt;ko1&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
        Simple answer is "yes".
    &lt;/p&gt;
    
    &lt;p&gt;
        On YARV, bytecode and other information are represented as the
        &lt;code&gt;VM::InstructionSequence&lt;/code&gt; class.  I often use the name
        "ISeq" to point that class.  ISeq object
        contains a bytecode sequence, a catch table (to retrieve exception
        and other global escape such as &lt;code&gt;break&lt;/code&gt;), a local variable
        name table and others.
    &lt;/p&gt;
    
    &lt;p&gt;
        ISeq object can be dumped in Ruby's primitive objects
        such as &lt;code&gt;Array&lt;/code&gt;, &lt;code&gt;Hash&lt;/code&gt;, &lt;code&gt;Fixnum&lt;/code&gt;
        and so on.  In the same way, ISeq can be
        built with such data with primitive objects.  This means that
        you can built YARV bytecode without YARV compiler.  Of course,
        this feature can be used for other purpose such as ruby script
        obfuscation (this is like Java class file).
    &lt;/p&gt;
    
    &lt;p&gt;
        (BTW, I use this feature on Ruby2C compiler.  It is hard to
        translate Ruby program to C program directly.  But from YARV
        instruction, translation is easy.  If I finished it, I want to
        bundle this with Ruby.)
    &lt;/p&gt;
    
    &lt;p&gt;
        Therefore it is hard to write ISeq dumped data.  So I had
        prepared &lt;code&gt;lib/yasm.rb&lt;/code&gt; as YARV Assembler (this is not
        committed on current trunk).  With &lt;code&gt;YASM&lt;/code&gt;, you can write YARV
        bytecode sequence on Ruby program.  Note that YARV/ISeq loader doesn't
        have the byte code verifier.  So illegal bytecode sequence is
        loaded, YARV/Ruby will dumps core.
    &lt;/p&gt;
    
    &lt;p&gt;
        If I commit &lt;code&gt;lib/yasm.rb&lt;/code&gt;, I'll write tutorial to use that.
    &lt;/p&gt;
  &lt;dd&gt;
&lt;/dd&gt;
&lt;/dd&gt;
&lt;/dl&gt;&lt;p&gt;&lt;strong&gt;Does the new Ruby VM optimize tail recursive methods?  If no, are there any plans to add this optimization?&lt;/strong&gt;&lt;/p&gt;

&lt;dl&gt;
&lt;dt&gt;
&lt;strong&gt;ko1&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
        YARV doesn't support "tail recursion optimization", but
        supports "tail call optimization".
    &lt;/p&gt;

    &lt;p&gt;
        See this program:
    &lt;/p&gt;
    
    &lt;div class="highlight highlight-ruby"&gt;&lt;pre&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;C&lt;/span&gt;
   &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;foo&lt;/span&gt;
     &lt;span class="n"&gt;foo&lt;/span&gt; &lt;span class="c1"&gt;# (A) tail recursive call&lt;/span&gt;
   &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;D&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;C&lt;/span&gt;
   &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;foo&lt;/span&gt;
     &lt;span class="k"&gt;super&lt;/span&gt;
   &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="n"&gt;D&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;new&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;foo&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

    &lt;p&gt;
        Can you replace &lt;code&gt;goto&lt;/code&gt; with (A)?  (A) should call
        &lt;code&gt;D#foo&lt;/code&gt; so we eliminate tail method call.  Yes, we
        can implement this optimization with following trick.
    &lt;/p&gt;
    
    &lt;div class="highlight highlight-ruby"&gt;&lt;pre&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;C&lt;/span&gt;
   &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;foo&lt;/span&gt;
     &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;search_method&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:foo&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;C&lt;/span&gt;&lt;span class="c1"&gt;#foo&lt;/span&gt;
       &lt;span class="n"&gt;goto&lt;/span&gt; &lt;span class="n"&gt;first_of_foo&lt;/span&gt;
     &lt;span class="k"&gt;else&lt;/span&gt;
       &lt;span class="n"&gt;foo&lt;/span&gt;
     &lt;span class="k"&gt;end&lt;/span&gt;
   &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

    &lt;p&gt;
        But we must think of inter block tail recursion or so (inter
        block goto is not permitted) if implement tail recursion
        optimization.
    &lt;/p&gt;

    &lt;p&gt;
        BTW, YARV support tail call optimization, eliminate stack
        frame of caller.  You can call method which at tail position
        without consuming VM stack like scheme language.  So you can
        use method call to loop something.  You can make state
        transition with method call.
    &lt;/p&gt;

    &lt;p&gt;
        Note that tail call optimization has some caution.  First is
        backtrace elimination.  You can't see caller method of tail
        method with backtrace.  Second, this optimization does
        &lt;strong&gt;not&lt;/strong&gt; speedup method call.  Tail call process is almost
        same as process of normal method call.  At end of normal method call
        process, check if tail call or not.  If that method call is
        tail call, use current method frame to setup method frame
        instead of pushing new stack frame.
    &lt;/p&gt;

    &lt;p&gt;
        Current Ruby 1.9 (trunk) is not enabled this optimization.  If
        you want to try this, please re-write that option in
        &lt;code&gt;vm_opts.h&lt;/code&gt; (&lt;code&gt;OPT_TAILCALL_OPTIMIZATION&lt;/code&gt;) and
        re-compile that. I think release version of Ruby 1.9 is enabled this
        optimization.  I need more comments of it.  Please teach me if
        you find out some critical problem.
    &lt;/p&gt;
  &lt;dd&gt;
&lt;/dd&gt;
&lt;/dd&gt;
&lt;/dl&gt;&lt;p&gt;&lt;strong&gt;Can you talk a little about some optimizations you would like to add to the new Ruby VM in the future?&lt;/strong&gt;&lt;/p&gt;

&lt;dl&gt;
&lt;dt&gt;
&lt;strong&gt;ko1&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
        In near future, I'll release AOT, Ruby to C compiler.  This
        translator will support all Ruby specification,
        so it's shouldn't be silver bullet for performance.
    &lt;/p&gt;
    
    &lt;p&gt;
        Keeping all Ruby spec means "can't achieve high
        performance".  If I ignore some spec, I'll be able to do more
        drastic optimization.  So C code translated from Ruby script
        will be slow (of course, faster than normal interpretation).
    &lt;/p&gt;

    &lt;p&gt;
        Ruby specification is enemy for compiler/VM developer.  So I
        want to add a "pragma" syntax to add programer's knowledge.
        For example, "&lt;code&gt;eval&lt;/code&gt; is not appear in this file" or
        "&lt;code&gt;Fixnum&lt;/code&gt; methods are not re-defined".  These information
        will help compiler to do more effective optimization.
    &lt;/p&gt;

    &lt;p&gt;
        And I'm planning to implement block inlining.  I think it is
        very effective for Ruby.  An experimental, incomplete version
        has been made.  I need more research to realize it.
    &lt;/p&gt;

    &lt;p&gt;
        BTW, I will not touch JIT compilation.  I think it is not
        reasonable (not worth the cost of implementation).  Everyone
        love "JIT" words, but I think it's not effective on Ruby spec.
    &lt;/p&gt;
  &lt;dd&gt;
&lt;/dd&gt;
&lt;/dd&gt;
&lt;/dl&gt;</content>
    <author>
      <name>James Edward Gray II</name>
    </author>
  </entry>
  <entry>
    <title>The Ruby VM:  Episode IV</title>
    <link rel="alternate" href="http://graysoftinc.com/the-ruby-vm-interview/the-ruby-vm-episode-iv"/>
    <id>tag:graysoftinc.com,2007-07-13:/posts/34</id>
    <updated>2014-04-04T21:27:35Z</updated>
    <summary>In this interview, Matz gives us the story behind the forthcoming m17n support for Ruby.</summary>
    <content type="html">&lt;p&gt;&lt;strong&gt;We've talked about threads, so let's talk a little about character encodings.  This is another big change planned for Ruby's future.  Matz, you have stated that you plan to add m17n (multilingualization) support to Ruby.  Can you talk a little about what that change actually means for Ruby users?&lt;/strong&gt;&lt;/p&gt;

&lt;dl&gt;
&lt;dt&gt;
&lt;strong&gt;Matz&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
        Nothing much, except for some incompatibility in string manipulation,
        for example, &lt;code&gt;"abc"[0]&lt;/code&gt; will give &lt;code&gt;"a"&lt;/code&gt; instead of
        &lt;code&gt;97&lt;/code&gt;, and string indexing will be based on character instead
        of byte.  I guess the biggest difference is that we can officially
        declare we support Unicode. ;-)
    &lt;/p&gt;

    &lt;p&gt;
        Unlike Perl nor Python, Ruby's M17N is not Unicode based (Universal
        Character Set or USC).  It's character set independent (CSI). It will
        handle Unicode, along with other encoding schemes such as ISO8859 or
        EUC-JP etc. without converting them into Unicode.
    &lt;/p&gt;

    &lt;p&gt;
        Some misunderstand our motivation.  We are no Unicode haters.  Rather,
        I'd love to use Unicode if situation allows.  We hate conversion
        between character sets.  For historical reasons, there are many
        variety of character sets.  For example, Shift_JIS character set has
        at least 5 variations, which differ each other in a few characters
        mapping.  Unfortunately, we have no way to distinguish them.  Thus
        conversion may cause information loss.  If a language provide Unicode
        centric text manipulation, there's no way to avoid the problem, as
        long as we use that language.
    &lt;/p&gt;
  &lt;dd&gt;
      
  &lt;/dd&gt;
&lt;/dd&gt;
&lt;dt&gt;
&lt;strong&gt;ko1&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
        On my policy, I escape from this topic :)
    &lt;/p&gt;
  &lt;dd&gt;
&lt;/dd&gt;
&lt;/dd&gt;
&lt;/dl&gt;&lt;p&gt;&lt;strong&gt;With String being enhanced to be encoding aware, some worry that we will need to specify an encoding for every String we make.  Can you talk a little about how this will work in practice?  Is there a default encoding?  Can we set an encoding for the entire program?&lt;/strong&gt;&lt;/p&gt;

&lt;dl&gt;
&lt;dt&gt;
&lt;strong&gt;Matz&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
        You can specify the encoding for Ruby scripts by the coding
        pragma at the head of the script.  For example, if your
        script is in UTF-8, try specify
    &lt;/p&gt;

        &lt;div class="highlight highlight-ruby"&gt;&lt;pre&gt;&lt;span class="c1"&gt;# coding: utf-8&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

    &lt;p&gt;
        that makes all strings and regex literals in the script to
        be specified UTF-8.  You can also specify the encoding for
        IO reading strings via open, e.g.
    &lt;/p&gt;
    
    &lt;div class="highlight highlight-ruby"&gt;&lt;pre&gt;&lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"r:utf-8"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
  &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gets&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

    &lt;p&gt;
        or by &lt;code&gt;binmode&lt;/code&gt; (ala Perl), e.g.
    &lt;/p&gt;
    
    &lt;div class="highlight highlight-ruby"&gt;&lt;pre&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"r"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;binmode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;":utf-8"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

    &lt;p&gt;
        The default encoding is binary for ordinary IO, and locale
        specified encoding for STDIN.  It should be allowed that
        encoding conversion at the time of IO reading, but the API
        is not fixed yet.  Maybe
    &lt;/p&gt;
    
    &lt;div class="highlight highlight-ruby"&gt;&lt;pre&gt;&lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"r:utf-8&amp;lt;euc-jp"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

    &lt;p&gt;
        that should read EUC-JP data then convert it into UTF-8 and
        return the converted string.
    &lt;/p&gt;
  &lt;dd&gt;
&lt;/dd&gt;
&lt;/dd&gt;
&lt;/dl&gt;&lt;p&gt;&lt;strong&gt;Can you tell us how far along the m17n code is and how much still needs to be done?  Is this change expected to be in the 1.9.1 release?&lt;/strong&gt;&lt;/p&gt;

&lt;dl&gt;
&lt;dt&gt;
&lt;strong&gt;Matz&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
        You will see M17N in 1.9.1 coming out next Christmas, unless something
        bad happens.  I have done almost everything for character treating,
        but things related to code conversion (&lt;code&gt;String#encode&lt;/code&gt; method and code
        conversion for IO) are still left undone.
    &lt;/p&gt;
  &lt;dd&gt;
&lt;/dd&gt;
&lt;/dd&gt;
&lt;/dl&gt;</content>
    <author>
      <name>James Edward Gray II</name>
    </author>
  </entry>
  <entry>
    <title>The Ruby VM:  Episode III</title>
    <link rel="alternate" href="http://graysoftinc.com/the-ruby-vm-interview/the-ruby-vm-episode-iii"/>
    <id>tag:graysoftinc.com,2007-04-27:/posts/33</id>
    <updated>2014-04-04T21:03:39Z</updated>
    <summary>In this interview, we get the scoop on the past and future of Ruby's threading support.</summary>
    <content type="html">&lt;p&gt;&lt;strong&gt;Let's talk a little about threading, since that's a significant change in the new VM.  First, can you please explain the old threading model used in Ruby 1.8 and also the new threading model now used in Ruby 1.9?&lt;/strong&gt;&lt;/p&gt;

&lt;dl&gt;
&lt;dt&gt;
&lt;strong&gt;Matz&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
      Old threading model is the green thread, to provide universal
      threading on every platform that Ruby runs.  I think it was reasonable
      decision 14 years ago, when I started developing Ruby.  Time goes by
      situation has changed.  pthread or similar threading libraries are now
      available on almost every platform.  Even on old platforms, pth
      library (a thread library which implements pthread API using setjmp
      etc.) can provide green thread implementation.
    &lt;/p&gt;

    &lt;p&gt;
      Koichi decided to use native thread for YARV.  I honor his decision.
      Only regret I have is we couldn't have continuation support that used
      our green thread internal structure.  Koichi once told me it's not
      impossible to implement continuation on YARV (with some restriction),
      so I expect to have it again in the future.  Although it certainly has
      lower priority in 1.9 implementation.
    &lt;/p&gt;
  &lt;dd&gt;
      
  &lt;/dd&gt;
&lt;/dd&gt;
&lt;dt&gt;
&lt;strong&gt;ko1&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
      Matz explained old one, so I show you YARV's thread model.
    &lt;/p&gt;

    &lt;p&gt;
      As you know, YARV support native thread.  It means that you can run each
      Ruby thread on each native thread concurrently.
    &lt;/p&gt;

    &lt;p&gt;
      It doesn't mean that every Ruby thread runs in parallel.  YARV has
      global VM lock (global interpreter lock) which only one running Ruby
      thread has.  This decision maybe makes us happy because we can run most
      of the extensions written in C without any modifications.
    &lt;/p&gt;
  &lt;dd&gt;
&lt;/dd&gt;
&lt;/dd&gt;
&lt;/dl&gt;&lt;p&gt;&lt;strong&gt;Why was this change made?  What's wrong with green threads?&lt;/strong&gt;&lt;/p&gt;

&lt;dl&gt;
&lt;dt&gt;
&lt;strong&gt;Matz&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
      Because green threads does not work well with libraries using native
      threads.  For example, Ruby/Tk has made huge effort to live along with
      pthread.
    &lt;/p&gt;
  &lt;dd&gt;
      
  &lt;/dd&gt;
&lt;/dd&gt;
&lt;dt&gt;
&lt;strong&gt;ko1&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
      Ruby's green (userlevel) thread implementation was too naive to run
      fast.  All machine stacks are copied when thread context switches.  And
      more important point is it's not easy to re-implement green thread on
      YARV :)
    &lt;/p&gt;
  &lt;dd&gt;
&lt;/dd&gt;
&lt;/dd&gt;
&lt;/dl&gt;&lt;p&gt;&lt;strong&gt;What are the downsides to the native threads approach?&lt;/strong&gt;&lt;/p&gt;

&lt;dl&gt;
&lt;dt&gt;
&lt;strong&gt;Matz&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
      It is pretty difficult to implement continuation.  Besides that, even
      with native thread approach, no real concurrency can not be made due
      to the global interpreter lock.  Koichi is going to address this issue
      by Multi-VM approach in the (near) future.
    &lt;/p&gt;
  &lt;dd&gt;
      
  &lt;/dd&gt;
&lt;/dd&gt;
&lt;dt&gt;
&lt;strong&gt;ko1&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
      Yes, it has several problems.  First is Performance problem (as you
      know, I love to discuss about performance).  Too create native thread is
      too pricey.  So you may use thread pool or so.  And current trunk (YARV)
      is not tuned on native thread, so I believe some unknown problems
      around threads.
    &lt;/p&gt;

    &lt;p&gt;
      Second problem is portability.  If your environment has pthread library,
      but there are some difference from other pthread system in detail.
    &lt;/p&gt;

    &lt;p&gt;
      Third problem is absence of callcc (which is implemented with green
      thread scheme) ... for some people :)
    &lt;/p&gt;

    &lt;p&gt;
      Programming on native thread has own difficulty.  For example, on MacOS
      X, exec() doesn't work (cause exception) if other threads are running
      (one of portability problem).  If we find critical problems on native
      thread, I will make green thread version on trunk (YARV).
    &lt;/p&gt;
  &lt;dd&gt;
&lt;/dd&gt;
&lt;/dd&gt;
&lt;/dl&gt;&lt;p&gt;&lt;strong&gt;Are there plans to support other threading models in the future?&lt;/strong&gt;&lt;/p&gt;

&lt;dl&gt;
&lt;dt&gt;
&lt;strong&gt;Matz&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
      Other threading model, no.  Win32 threads and pthreads are enough
      burden for us to support.  There might be other features to support
      parallelism in the future, for example light-weight process a la
      Erlang.
    &lt;/p&gt;

    &lt;p&gt;
      Koichi may have other idea(s) about supporting concurrency, such as
      Multi-VM since he is the expert on it.
    &lt;/p&gt;
  &lt;dd&gt;
      
  &lt;/dd&gt;
&lt;/dd&gt;
&lt;dt&gt;
&lt;strong&gt;ko1&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
      Parallel computing with Ruby is one of my main concern.  There are some
      way to do it, but running Ruby threads in parallel (without Giant VM
      Lock) on a process is too difficult to support current C extension
      libraries because of their synchronization problems.
    &lt;/p&gt;

    &lt;p&gt;
      As matz say, if we have multiple VM instance on a process, these VMs can
      be run in parallel.  I'll work on that theme in the near future (as my
      research topic).
    &lt;/p&gt;

    &lt;p&gt;
      BTW, I wrote on last question, if there are many many problems on native
      threads, I'll implement green thread.  As you know, it's has some
      benefit against native thread (lightweight thread creation, etc).  It
      will be lovely hack (FYI. my graduation thesis is to implement userlevel
      thread library on our specific SMT CPU).
    &lt;/p&gt;

    &lt;p&gt;
      ... Does anyone have interest to implement it?
    &lt;/p&gt;
  &lt;dd&gt;
&lt;/dd&gt;
&lt;/dd&gt;
&lt;/dl&gt;</content>
    <author>
      <name>James Edward Gray II</name>
    </author>
  </entry>
  <entry>
    <title>The Ruby VM:  Episode II</title>
    <link rel="alternate" href="http://graysoftinc.com/the-ruby-vm-interview/the-ruby-vm-episode-ii"/>
    <id>tag:graysoftinc.com,2007-03-16:/posts/31</id>
    <updated>2014-04-30T02:30:03Z</updated>
    <summary>In this interview, we discuss all of the alternate Ruby implementations that have sprung up and what they mean for language and developers.</summary>
    <content type="html">&lt;p&gt;&lt;strong&gt;We started these talks because of the excitement around the alternate implementations, like JRuby and Rubinius.  How do you feel about all of these new interpreters and how do you see them affecting the official development of Ruby?&lt;/strong&gt;&lt;/p&gt;

&lt;dl&gt;
&lt;dt&gt;
&lt;strong&gt;Matz&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
      Alternate implementations mean maturity of Ruby language.  I'm glad
      for the fact.  But we have never had enough number of developers for
      core, so I think we need more cooperation between implementations.  I
      had a good talk about future Ruby spec. with Charles Nutter recently.
      I expect occasion like this more often.
    &lt;/p&gt;
  &lt;dd&gt;
      
  &lt;/dd&gt;
&lt;/dd&gt;
&lt;dt&gt;
&lt;strong&gt;ko1&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
      I think having alternatives is very important.  I want to know how to
      implement Ruby and apply these techniques to YARV.
    &lt;/p&gt;

    &lt;p&gt;
      In fact, implementing from scratch is very fun.  YARV (official Ruby
      implementation) has many problems resulted from historical reasons (a
      biggest problem is compatibility to extension libraries).
    &lt;/p&gt;
  &lt;dd&gt;
&lt;/dd&gt;
&lt;/dd&gt;
&lt;/dl&gt;&lt;p&gt;&lt;strong&gt;Have you downloaded and installed any of the other interpreters?&lt;/strong&gt;&lt;/p&gt;

&lt;dl&gt;
&lt;dt&gt;
&lt;strong&gt;Matz&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
      No, I just skimmed a few files from Rubinius, but not others.  Mostly
      because I am not familiar with neither Java nor Parrot.
    &lt;/p&gt;
  &lt;dd&gt;
      
  &lt;/dd&gt;
&lt;/dd&gt;
&lt;dt&gt;
&lt;strong&gt;ko1&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
      I wanted to try these alternatives, but no time to do it (and no time to
      hack YARV ...).
    &lt;/p&gt;

    &lt;p&gt;
      Answer is:  No.  I'll try.
    &lt;/p&gt;
  &lt;dd&gt;
&lt;/dd&gt;
&lt;/dd&gt;
&lt;/dl&gt;&lt;p&gt;&lt;strong&gt;Is there a good exchange of ideas between the various implementation teams?  Do you talk to the other teams, read their code, and/or discuss implementation details with them?&lt;/strong&gt;&lt;/p&gt;

&lt;dl&gt;
&lt;dt&gt;
&lt;strong&gt;Matz&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
      Besides Koichi who works on YARV with me, Last month I met with
      Charles Nutter and exchanged very interesting idea about 2.0 behavior.
      Evan Phoenix also gave me inspiration.  I am very glad to see more
      programmers with interest and knowledge in language implementation.
    &lt;/p&gt;
  &lt;dd&gt;
      
  &lt;/dd&gt;
&lt;/dd&gt;
&lt;dt&gt;
&lt;strong&gt;ko1&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
      Sometimes I talked with JRuby team on IRC.  I want to discuss every Ruby
      implementation developers, especially performance of it.
    &lt;/p&gt;

    &lt;p&gt;
      BTW we need 3 things on this context:
    &lt;/p&gt;

    &lt;ol&gt;
&lt;li&gt;Documents of specification&lt;/li&gt;
      &lt;li&gt;Good tests&lt;/li&gt;
      &lt;li&gt;Good benchmarks&lt;/li&gt;
    &lt;/ol&gt;
&lt;p&gt;
      &lt;em&gt;Tests:&lt;/em&gt; Ruby trunk and 1.8 have test suits. But it's too difficult
      to test with it on early stage of implementation, because test/unit use
      many ruby's functions (RSpec has a same problem). Now, trunk has
      "bootstraptest" to solve it. I think it is good solution for this problem.
      And it's show a minimum ruby's specification.
    &lt;/p&gt;

    &lt;p&gt;
      &lt;em&gt;Benchmark tests:&lt;/em&gt; Some people using YARV's benchmarks I wrote. But
      I didn't write these codes to measure "Ruby's general benchmark test", but
      to measure speed-up ratio on YARV. It's means that I wrote codes what YARV
      optimizes. We must prepare more suitable benchmarks for "Ruby
      implementations".
    &lt;/p&gt;
  &lt;dd&gt;
&lt;/dd&gt;
&lt;/dd&gt;
&lt;/dl&gt;</content>
    <author>
      <name>James Edward Gray II</name>
    </author>
  </entry>
  <entry>
    <title>The Ruby VM:  Episode I</title>
    <link rel="alternate" href="http://graysoftinc.com/the-ruby-vm-interview/the-ruby-vm-episode-i"/>
    <id>tag:graysoftinc.com,2007-02-16:/posts/29</id>
    <updated>2014-04-04T20:29:56Z</updated>
    <summary>This first interview covers who I'm talking with, what we are talking about, and when we will see the results of their labor.</summary>
    <content type="html">&lt;p&gt;&lt;strong&gt;Hello and thank you both for agreeing to answer my questions.  To begin, would you please introduce yourselves and tell us about your role in Ruby's development?&lt;/strong&gt;&lt;/p&gt;

&lt;dl&gt;
&lt;dt&gt;
&lt;strong&gt;Matz&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
      I am the designer and the first implementer of the Ruby language.  My
      real name is Yukihiro Matsumoto, that sounds something like
      You-Key-Hero Matz-Motor in English.  But it's too long to remember and
      pronounce, so just call me Matz.
    &lt;/p&gt;

    &lt;p&gt;
      I have been developing Ruby since 1993.  It is now quite complicated
      and has performance problem.  I have had vague plan of rewriting the
      interpreter for long time, but I have never been motivated enough to
      throw out the current interpreter and start developing new one.
    &lt;/p&gt;

    &lt;p&gt;
      Then Koichi came in with YARV that seemed to have much brighter future
      than my vaporware - it runs - so I asked him to take a role of the
      official implementer of the core.  Although I enjoy both designing and
      implementation of the language, I don't think I am gifted for language
      implementation.  So I thought that it might be the time to focus on
      designing when I saw YARV.
    &lt;/p&gt;
  &lt;dd&gt;
      
  &lt;/dd&gt;
&lt;/dd&gt;
&lt;dt&gt;
&lt;strong&gt;ko1&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
      Thank you for your interest in YARV and me.  BTW, I'm thinking what "YARV"
      stand for.  Because it is not Yet Another.  Someone proposed that "YARV
      ain't RubyVM".  If YARV means "YARV ain't RubyVM", what is YARV?
    &lt;/p&gt;

    &lt;p&gt;
      I'm Koichi Sasada.  Koichi is given name, and "ichi" means "one" in
      Japanese.  So I use "ko1" as my nick.  I'm an assistant at Department
      (...snip...) of Tokyo.  My research interest is systems software,
      especially operating system, programming language, parallel systems, and
      so on.  And I'm a member of Nihon Ruby no Kai (Ruby Association in Japan).
      I plan(ed) some Ruby events like
      &lt;a href="http://jp.rubyist.net/RubyKaigi2007/english.html"&gt;RubyKaigi&lt;/a&gt;
      and am an editor of
      &lt;a href="http://jp.rubyist.net/magazine"&gt;Rubyist Magazine&lt;/a&gt;.  I also
      develop(ed) &lt;a href="http://www.atdot.net/nadoka/"&gt;Nadoka&lt;/a&gt;,
      &lt;a href="http://www.namikilab.tuat.ac.jp/~sasada/prog/rava2.html"&gt;Rava&lt;/a&gt;,
      &lt;a href="http://www.namikilab.tuat.ac.jp/~sasada/prog/rucheme.html"&gt;Rucheme&lt;/a&gt;,
      and some projects.  Say, I'm a developer of YARV: Yet Another RubyVM.
    &lt;/p&gt;

    &lt;p&gt;
      My role in Ruby's development?  To steal VM hacking pleasure from Matz?
    &lt;/p&gt;
  &lt;dd&gt;
&lt;/dd&gt;
&lt;/dd&gt;
&lt;/dl&gt;&lt;p&gt;&lt;strong&gt;The point of this interview is to talk about the future of Ruby's interpreter.  To start that, can you please explain what YARV/Rite is?  How is it different in design from the old Ruby interpreter?&lt;/strong&gt;&lt;/p&gt;

&lt;dl&gt;
&lt;dt&gt;
&lt;strong&gt;Matz&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
      I have always been more interested in designing the language than
      implementing it.  So Ruby interpreter is always slower than it should
      be.  I think I pruned all low-hanging fruits, so that it seemed to
      required to re-implement whole core to achieve performance boost.  I
      planned a new interpreter code-named 'Rite' in 2001 or so, but I have
      never motivated enough to start the project.  Maybe I had been too
      busy, or perhaps too lazy.
    &lt;/p&gt;

    &lt;p&gt;
      Then, Koichi came in, and showed us his YARV.  Many had tried
      implementing Ruby interpreter in the past, but no one but Koichi
      reached that level of implemented feature set (at the time; now we
      have JRuby and RubyCLR both compatible with Ruby 1.8).  So I asked him
      to take part in the development of the new core, and he agreed.
    &lt;/p&gt;

    &lt;p&gt;
      January 1st 2007, he checked in YARV in to the trunk of our
      repository, so it is now official core of the Ruby 1.9.  I am still
      working on old implementation in matzruby branch.  Since it is easier
      for me to experiment new language features on the old interpreter, but
      I will eventually switch to the new engine.
    &lt;/p&gt;

    &lt;p&gt;
      For YARV implementation detail, Koichi will explain.
    &lt;/p&gt;

    &lt;p&gt;&lt;strong&gt;Does this mean we are leaving the name Rite behind and keeping YARV?  Or will YARV be renamed at some point?&lt;/strong&gt;&lt;/p&gt;

    &lt;p&gt;
      The name Rite will not be used for this generation of the language,
      unless Koichi ask me.  I am not sure Koichi is going to keep YARV, or
      not, since it already 'the VM' for Ruby.
    &lt;/p&gt;
  &lt;dd&gt;
      
  &lt;/dd&gt;
&lt;/dd&gt;
&lt;dt&gt;
&lt;strong&gt;ko1&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
      YARV is vanished :)
    &lt;/p&gt;

    &lt;p&gt;
      In fact, I'm removing "yarv" words from structure names, function names,
      and file names.  YARV is only code name that not made by *Matz*.  Now,
      YARV is not "Yet Another".  In this article, I use "YARV" words as
      current Ruby trunk on official repository.
    &lt;/p&gt;

    &lt;p&gt;
      At first, YARV is simple stack machine which run pseudo sequential
      instructions.  Old interpreter (matzruby) *traverses* abstract syntax
      tree (AST) naively.  Obviously it's slow.  YARV compile that AST to YARV
      bytecode and run it.
    &lt;/p&gt;

    &lt;p&gt;
      Secondly, YARV uses native thread (that supported by OS or so) to
      implement Ruby thread.  It means that you can run *blocking* task in
      extension libraries.  &lt;em&gt;(On Ruby's spec, blocking task should be
      interrupted by &lt;code&gt;Thread#raise&lt;/code&gt;. To know details, see
      &lt;a href="http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/10252"&gt;[ruby-core:10252]&lt;/a&gt;.)&lt;/em&gt;
      Because thread creation is slower than matzruby (green thread), you
      shouldn't make many threads at a time. Supporting native thread *does not*
      means that you can run Ruby scripts in *parallel* on parallel machine such
      as Multi-Core CPUs.  Current implementation uses Giant VM Lock to avoid
      synchronization problems.  &lt;em&gt;(Many extension libraries doesn't care
      thread safety.  See &lt;code&gt;array.c&lt;/code&gt;, &lt;code&gt;string.c&lt;/code&gt;,
      etc.)&lt;/em&gt;
    &lt;/p&gt;

    &lt;p&gt;
      Thirdly, I made many optimization like specialized instructions, etc.
      These features are my purpose of developing YARV.  Toy benchmarks run
      fast because of these optimization techniques.
    &lt;/p&gt;

    &lt;p&gt;
      YARV doesn't change parser/syntax/specs (matz'
      &lt;span style="text-decoration: line-through"&gt;hobby&lt;/span&gt;task), GC
      (memory/object management), and extension libraries like
      &lt;code&gt;String&lt;/code&gt;/&lt;code&gt;Array&lt;/code&gt;/&lt;code&gt;Hash&lt;/code&gt;/&lt;code&gt;Regexp&lt;/code&gt;/etc.
      Therefore your script doesn't run fast on YARV if bottleneck is string
      processing, or so.
    &lt;/p&gt;
  &lt;dd&gt;
&lt;/dd&gt;
&lt;/dd&gt;
&lt;/dl&gt;&lt;p&gt;&lt;strong&gt;Congratulations to you both for completing Ruby/YARV merger recently. That must have been a lot of work, but I know it has the whole Ruby world very excited. Now that the merger has taken place, how do you see this changing the way Ruby is developed?&lt;/strong&gt;&lt;/p&gt;

&lt;dl&gt;
&lt;dt&gt;
&lt;strong&gt;Matz&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
      Congrats should go to Koichi who has done a lot of work.  I am moving
      my developing from matzruby (a branch for my old interpreter) to
      trunk (the yarv).  Recently I have implemented some new features on
      the trunk, for example, class local instance variables and new local
      variable scope.  The transition will complete pretty soon.
    &lt;/p&gt;

    &lt;p&gt;
      Since the trunk is originally Koichi's work, I need more help from
      others especially from Koichi than before.  I know everything about
      the previous interpreter (well, most of them), but there are still
      mysteries in the new one.  I am well satisfied with new one.  It's
      clearer, well-formed, and faster.
    &lt;/p&gt;
  &lt;dd&gt;
      
  &lt;/dd&gt;
&lt;/dd&gt;
&lt;dt&gt;
&lt;strong&gt;ko1&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
      Thank you.  I'm a newbie of Ruby developer (in fact, I didn't have CVS
      account to commit any ruby codes).  So I can't say how change on ruby
      development :)
    &lt;/p&gt;
  &lt;dd&gt;
&lt;/dd&gt;
&lt;/dd&gt;
&lt;/dl&gt;&lt;p&gt;&lt;strong&gt;When will the first production release of Ruby running on YARV by available for all Rubyists to play with?&lt;/strong&gt;&lt;/p&gt;

&lt;dl&gt;
&lt;dt&gt;
&lt;strong&gt;Matz&lt;/strong&gt;:&lt;/dt&gt;
  &lt;dd&gt;
    &lt;p&gt;
      Short answer: now.
    &lt;/p&gt;

    &lt;p&gt;
      Longer answer: the YARV is already publicly avaiblabe via our
      Subversion repository.  You can fetch and play with it now.  But the
      first public "release" from us will be Christmas 2007, if we are as
      diligent as we should be.  Knowing how lazy I am, I will try not to be
      a stumbling block for the release. ;-)
    &lt;/p&gt;
  &lt;dd&gt;
&lt;/dd&gt;
&lt;/dd&gt;
&lt;/dl&gt;</content>
    <author>
      <name>James Edward Gray II</name>
    </author>
  </entry>
  <entry>
    <title>The Ruby VM Serial Interview</title>
    <link rel="alternate" href="http://graysoftinc.com/the-ruby-vm-interview/the-ruby-vm-serial-interview"/>
    <id>tag:graysoftinc.com,2007-02-16:/posts/28</id>
    <updated>2014-04-04T21:40:57Z</updated>
    <summary>This article outlines a new series where we will see Matz and Koichi discussing the beating heart of our favorite programming language.</summary>
    <content type="html">&lt;p&gt;I have really enjoyed reading Pat Eyler's &lt;a href="http://on-ruby.blogspot.com/search/label/rubinius"&gt;Rubinius Serial Interview&lt;/a&gt; and Nick Sieger's spun-off &lt;a href="http://blog.nicksieger.com/articles/tag/jrubyserialinterview"&gt;JRuby Serial Interview&lt;/a&gt;.  It's very educational to read what the developers have to say about their projects and ideas.&lt;/p&gt;

&lt;p&gt;The more I read though, the more I wanted the equivalent content for the official Ruby VM.  I asked Matz and Koichi if they would be willing to answer questions from me and they agreed to do so.  We are now ready to share their responses with the community.&lt;/p&gt;

&lt;p&gt;This will be a &lt;em&gt;serial interview&lt;/em&gt; as Pat Eyler calls them.  We will deliver regular episodes until I run out of good questions or Matz and Koichi get sick of me bothering them, whichever comes first.  I will ask the questions in the interview, but feel free to make suggestions in the comments to this article.&lt;/p&gt;

&lt;p&gt;One last note:  we are not promising any kind of schedule for the episodes.  Matz and Koichi are heroically providing their answers in English.  We want to respect how much work that is and give them all the time they need to do that.  Personally, I cannot thank them enough.&lt;/p&gt;

&lt;p&gt;With that, I give you the episode index:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; In this &lt;a href="/the-ruby-vm-interview/the-ruby-vm-episode-i"&gt;first episode&lt;/a&gt; I ask Matz and Koichi to introduce themselves and their roles as well as to give us an update on where we are with the Ruby VM.&lt;/li&gt;
&lt;li&gt; In the &lt;a href="/the-ruby-vm-interview/the-ruby-vm-episode-ii"&gt;second episode&lt;/a&gt; I ask Matz and Koichi about for their thoughts on the alternate Ruby implementations and how they see them changing Ruby's development.&lt;/li&gt;
&lt;li&gt; In the &lt;a href="/the-ruby-vm-interview/the-ruby-vm-episode-iii"&gt;third episode&lt;/a&gt; Matz and Koichi discuss the past, present and future of Ruby threading.&lt;/li&gt;
&lt;li&gt; In the &lt;a href="/the-ruby-vm-interview/the-ruby-vm-episode-iv"&gt;fourth episode&lt;/a&gt; Matz tells us a little about how m17n is shaping up.&lt;/li&gt;
&lt;li&gt; In the &lt;a href="/the-ruby-vm-interview/the-ruby-vm-episode-v"&gt;fifth episode&lt;/a&gt; Koichi gives us the inside story on optimization in the new VM.&lt;/li&gt;
&lt;/ol&gt;</content>
    <author>
      <name>James Edward Gray II</name>
    </author>
  </entry>
</feed>
