InfoQ

News

MacRuby 0.5 Will Have Faster VM Based on LLVM,

Posted by Werner Schuster on Mar 29, 2009

Community
Ruby
Topics
Performance & Scalability ,
Runtimes ,
Rich Client / Desktop
Tags
Ruby1.9 ,
GarbageCollection ,
LLVM ,
Virtual Machines ,
MacRuby

After the MacRuby 0.4 release brought a new graphics library and improvements such as a Threaded GC, the next version of MacRuby will feature improvements in performance.
A blog entry now explains the new LLVM based VM, which will replace YARV, in an experimental branch of MacRuby:

The new VM transforms the abstract source tree (AST) directly from the parser into LLVM's intermediate representation (IR), which is then compiled into optimized machine code. A number of other key optimizations have also been completed, such as fast fixnum arithmetic, cached method dispatch, zero-cost IA64 exceptions, fast instance variable access, constants caching, fast break/next, cheap local variables, tail call optimization and much more.

The source for Roxor, the new VM, is available in an experimental SVN branch. The compile_node method basically takes the Ruby AST and turns it into LLVM instructions consisting of either primitives or calls to the Ruby runtime.

While MacRuby is based on Ruby 1.9.1, some of the changes such as the new experimental VM and use of Objective-C types can cause compatibility issues. To keep compatibility in check, MacRuby's integrated with RubySpec (from the blog entry):

The current experimental branch is already able to pass most of the language specifications and will be a standard part of our regression test suite. We are also actively working on upgrading the specifications to match the Ruby 1.9 behaviors.

RubySpec is an executable spec for the behavior of Ruby implementations, and was started by the Rubinius project.

Antonio Cangiano ran a few language feature microbenchmarks on the experimental MacRuby version, which yielded very good results compared to MRI and standard 1.9.1. It remains to be seen how the performance develops over the next release(s). Antonio also points out some of the advantages of MacRuby:

Rather than relying on a mix of Objective-C and Ruby (through a bridge like RubyCocoa), developers can use MacRuby which integrates with Mac OS X core technologies and acts as an alternative language to Objective-C. To be exact, Objective-C's runtime and generational garbage collector are at the heart of MacRuby, but from an API standpoint, programmers can write code in Ruby, instead of in the more verbose and low level Objective-C.

Considering the long list of GUI libraries and abstractions for Ruby, developers targeting OS X can simply MacRuby to build applications that tightly integrate with the Cocoa libraries, instead of having to use Objective-C.

MacRuby by Matt Aimonetti Posted Mar 29, 2009 8:16 PM
Charles Nutter (jRuby) responds .. by Cameron Purdy Posted Mar 29, 2009 9:49 PM
Re: Charles Nutter (jRuby) responds .. by Werner Schuster Posted Mar 30, 2009 5:56 AM
  1. Back to top

    MacRuby

    Mar 29, 2009 8:16 PM by Matt Aimonetti

    Great article! For latest MacRuby news you can also follow @macruby on twitter.

  2. Back to top

    Charles Nutter (jRuby) responds ..

    Mar 29, 2009 9:49 PM by Cameron Purdy

  3. Back to top

    Re: Charles Nutter (jRuby) responds ..

    Mar 30, 2009 5:56 AM by Werner Schuster

    Yeah - but be sure to read the comments on Antonio's article, for some clarifications/rebuttals (in particular Rich Kilmer's).

Educational Content

Brian Marick on 4 Challenges and 5 Guiding Values of Agile Software Development

Brian Marick takes us through a quick tour of the most important values and challenges to adopting Agile successfully (they aren't the typical challenges and values we hear in the community).

Are You a Software Architect?

The line between development and architecture is tricky. Does it exist at all? Is an ivory tower actually needed? There's a balance in the middle, but how do you move from developer to architect?

Agile – A Way of Life and Pragmatic Use of Authority

The word 'authority' sometimes produces an allergic response in hard-line agilists. Freedom and authority – both are bad if misused and both are good if used in right spirit for a noble cause.

Getting Started with Grails, Second Edition

"Getting Started with Grails" brings you up to speed on this modern web framework. Companies as varied as LinkedIn, Wired, and Taco Bell are all using Grails. Are you ready to get started as well?

Using ITIL V3 as a Foundation for SOA Governance

Those familiar with only ITIL V2 often scoff at the thought that ITIL could serve as a governance framework for SOA. With ITIL V3, the focus of the framework shifted towards service-orientation.

Adrian Colyer on AspectJ, tc Server and dm Server

SpringSource CTO Adrian Colyer discusses AspectJ, SpringSource's dm Server and tc Server products, OSGi and Scrum.

Adam Wiggins on Heroku

Heroku's Adam Wiggins talks about Rails, Background Jobs, Add-Ons, Ruby, and how Heroku manages to work around Ruby's inefficiencies using Erlang and other languages.

SOA as an Architectural Pattern: Best Practices in Software Architecture

For Grady Booch the foundation of a good architecture is patterns, SOA being just one of many patterns. In this Second Life presentation, Booch attempts to bring more clarity on what architecture is.