Ruby VMs are improving steadily and the last few weeks have seen a bunch of new releases.
Rubinius 1.2 has been released, bringing improvements in memory efficiency and debugging. Evan Phoenix explains the details of the changes in Rubinius 1.2, such as the per object memory use:
[..] We focused on improving the memory usage per object. Specifically, how an object stores its instance variables in memory. Because Ruby does not require instance variable declaration, the simplest way to model instance variables is with a hash. This is precisely what Rubinius used to do. The issue is for classes that have a small number of instance variables. In this case, the size of the hash table is substantial, needing more than 100 bytes of memory just to store one word (either 4 or 8 bytes)! [..]
The new code is based upon an easily observable assumption about a class, namely that it defines the vast majority (usually all) of its methods before an instance of the class is created. We exploit this by running some code the first time an instance of a class is created which looks at all methods available to instances of this class. This means all methods defined in the class itself, its superclasses, and any mixed in modules. From the methods, we build a table of all instance variables those methods use.
Now we can construct a very good picture of how memory should be laid out for instances of this class, allowing us to store the instance variables in memory without needing a hash table. The memory usage typically goes from 100 bytes to 8 bytes on a 64bit machine.
Rubinius has long had a powerful Debugger API, and now Rubinius 1.2 adds ruby-debug support. Debugging memory usage or memory leaks is aided by the heap dump feature, which can be used with Rubinius::VM.dump_heap("/path/to/file")
. An alternative way of creating a heap dump is to use another useful Rubinius feature: the Query Agent, which allows monitoring tools to access Rubinius information as well as trigger certain actions.
MacRuby 0.8 is available and mostly improves stability and compatibility. The project will now focus on the 1.0 release:
We intend to deliver starting from now releases much more frequently than before. We hope that users will then test MacRuby more frequently, and as such, report more bugs.
However, we do not expect further releases to introduce significant features, as we are now focusing on stability and compatibility issues.
Finally, both old and new MRIs have just received patchlevel releases: MRI 1.8.7 with p330 and 1.9.2 with p136, the first update since the 1.9.2 release.