InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

MacRuby 0.5 Will Have Faster VM Based on LLVM,

Posted by Werner Schuster on Mar 29, 2009

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

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
Charles Nutter (jRuby) responds .. by Cameron Purdy Posted
Re: Charles Nutter (jRuby) responds .. by Werner Schuster Posted
  1. Back to top

    MacRuby

    by Matt Aimonetti

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

  2. Back to top

    Charles Nutter (jRuby) responds ..

    by Cameron Purdy

  3. Back to top

    Re: Charles Nutter (jRuby) responds ..

    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

Attila Szegedi on JVM and GC Performance Tuning at Twitter

Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.

Interview: Software Systems Architecture: Working With Stakeholders Using Viewpoints and Perspectives

InfoQ spoke to the authors of Software Systems Architecture on a couple of new topics, the System Context viewpoint and Agile, which have been added to the second edition.

Beauty Is in the Eye of the Beholder

Alex Papadimoulis discusses ugly code, where it comes from, how to avoid it, and how to get rid of it.

Architecting Visa for Massive Scale and Continuous Innovation

John Davies examines Visa’s architecture and shows how enterprises have architected complex integrations incorporating Hadoop, memcached, Ruby on Rails, and others to deliver innovative solutions.

Max Protect: Scalability and Caching at ESPN.com

Sean Comerford unveils ESPN.com’s architecture, what components are used and why, and the current changes the website goes through.

The Seven Deadly Sins of Enterprise Agile Adoption

Are there repeated patterns of failure on Enterprise Agile Enablement efforts? Sanjiv and Arlen discuss Seven Deadly Sins to avoid when adopting Agile in an enterprise.

Questions for an Enterprise Architect

Erik Dörnenburg answers: What is Enterprise and Evolutionary Architecture?, discussing 4 issues: Turning strategy into execution, Ensuring conformance, Where do the architects sit? Buying or building?