JRuby
Encyclopedia
JRuby is a Java
implementation of the Ruby programming language
, being developed by the JRuby team. It is free software
released under a three-way CPL
/GPL
/LGPL
license. JRuby is tightly integrated with Java
to allow the embedding of the interpreter into any Java application with full two-way access between the Java and the Ruby code (similar to Jython
for the Python language).
JRuby's lead developers are Charles Nutter, Thomas Enebo, Ola Bini and Nick Sieger. In September 2006, Sun Microsystems
hired Enebo and Nutter to work on JRuby full time. In June 2007, ThoughtWorks
hired Ola Bini to work on Ruby and JRuby. In July 2009, the JRuby developers left Sun to continue JRuby development at Engine Yard
.
code. With the release of Ruby 1.8.6, an effort began to update JRuby to 1.8.6 features and semantics. Since 2001, several contributors have assisted the project, leading to the current core team of four members.
JRuby 1.1 added Just-in-time compilation
and Ahead-of-time compilation
modes to JRuby and was already faster in most cases than the current Ruby 1.8.7 reference implementation.
JRuby 1.1.1 is stated to be packaged in Fedora 9.
On July 2009, the core JRuby developers, Charles Nutter, Thomas Enebo and Nick Sieger, joined Engine Yard
to continue JRuby development.
JRuby initially supported Ruby MRI
1.8.6. Since 1.4.0 it also supports Ruby 1.8.7, and since 1.6.0 it supports Ruby 1.9.2.
since version 0.9 (May 2006), with the ability to execute RubyGems
and WEBrick
. Since the hiring of the two lead developers by Sun, Rails compatibility and speed have improved greatly. JRuby version 1.0 successfully passed nearly all of Rails' own test cases. Since then, developers have begun to use JRuby for Rails applications in production environments .
and the University of Tokyo
announced a joint-research project to implement a virtual machine capable of executing more than one Ruby
or JRuby application on one interpreter.
The Sun
Open source project Multi Language Virtual Machine
aim to prototype this JSR. The first working prototype, developed as a patch on OpenJDK
, was announced and made available on end of August 2008.
The JRuby team has successfully wired dynamic invocation in their codebase, albeit in a very primitive way. Dynamic invocation shipped with the 1.1.5 release, although being disabled on JVM
s without Dynamic invocation capabilities.
The project gets coordinated here at codehaus.org,
you can find also the official release history resp. plan there.
In March 2011, core JRuby developer Thomas Enebo said in an interview that the group was still in the planning stages of version 1.7, and expected to have several 1.6.x point releases before then. Features currently being planned include:
unmodified using JRuby. In the process of achieving this goal, the JRuby test suite expanded to such extent that the team gained confidence in the "correctness" of JRuby. As a result, toward the end of 2006 and in the beginning of 2007, they began to commit much more complicated redesigns and refactorings of JRuby's core subsystems.
JRuby is designed to work as a mixed-mode virtual machine for Ruby, where code can be either interpreted directly, just-in-time
compiled at runtime to Java bytecode, or ahead-of-time
compiled to Java bytecode before execution. Until October 2007, only the interpreted
mode supported all Ruby's constructs, but a full AOT
/JIT
compiler is available since version 1.1. The compiler design allows for interpreted and compiled code to run side-by-side, as well as decompilation to reoptimize and outputting generated bytecode
as Java class files.
JRuby is commercially supported by Engine Yard
. It uses Unicode natively. It offers access to the large ecosystem of Java libraries, using Ruby syntax. Java application servers like GlassFish
can be used to run JRuby applications at enterprise scale.
, RSpec
, Rake
, and RubyGems
. It embeds an FFI
subsystem to allow to use C
libraries bundled as gems
. It also allows launching the Interactive Ruby Shell
(irb) as Ruby MRI
does.
The Netbeans Ruby Pack, available since NetBeans 6.0, allows IDE development with Ruby
and JRuby, as well as Ruby on Rails
for the two implementations of Ruby.
. JRuby features some of the same concepts, including object-oriented programming
, and dynamic-typing as Ruby. The key difference is that JRuby is tightly integrated with Java, and can be called directly from Java programs. Java has significant footing in the development of web applications.
JRuby also allows the user to call Java code using the more Ruby-like underscore method naming and to refer to JavaBean properties as attributes:
framework. More information on this is available in the JRuby Wiki article.
, AOT mode
, and JIT mode
(the last two modes are available since version 1.1). JRuby evolved from being several times slower than Ruby Reference implementation
, to being several times faster.
Benchmarks as of 16 December 2009, show JRuby using between 2 and 56 times the memory of Ruby MRI.
JRuby developer Charles Nutter claims that Java JDK7 gives a performance boost to JRuby, saying "On bench_threaded_reverse, Java 7 is 20% faster than Java 6, and JRuby plus invokedynamic is 20% faster than that".https://twitter.com/#!/headius/status/78282122997149696
, JRuby was 50% to 70% slower than C Ruby 1.8
. Since then, JRuby performance in interpreted mode has improved a lot. The JRuby team claims that JRuby 1.1.4 is 15%-20% faster in interpreted mode than Ruby MRI
.
When using Ruby 1.9 (YARV
) benchmarks on Java 6
, interpreted JRuby 1.0 was 4 times slower than Ruby (including startup time).
is available since JRuby 1.1. In performance benchmarks, JRuby 1.6.3 version outperforms C Ruby 1.9
in most cases.
Also in a real Mongrel web server
application, JRuby performance is better than Ruby (after the Virtual Machine
has instantiated).
Any implementation is usually noted for its speed. According to some benchmarks, JRuby is faster when compared to other implementations as noted above. Keep in mind the Java virtual machine takes time to load, too, but this is taken out of consideration.
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
implementation of the Ruby programming language
Ruby (programming language)
Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto...
, being developed by the JRuby team. It is free software
Free software
Free software, software libre or libre software is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with restrictions that only ensure that further recipients can also do...
released under a three-way CPL
Common Public License
In computing, the CPL is a free software / open-source software license published by IBM. The Free Software Foundation and Open Source Initiative have approved the license terms of the CPL....
/GPL
GNU General Public License
The GNU General Public License is the most widely used free software license, originally written by Richard Stallman for the GNU Project....
/LGPL
GNU Lesser General Public License
The GNU Lesser General Public License or LGPL is a free software license published by the Free Software Foundation . It was designed as a compromise between the strong-copyleft GNU General Public License or GPL and permissive licenses such as the BSD licenses and the MIT License...
license. JRuby is tightly integrated with Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
to allow the embedding of the interpreter into any Java application with full two-way access between the Java and the Ruby code (similar to Jython
Jython
Jython, successor of JPython, is an implementation of the Python programming language written in Java.-Overview:Jython programs can seamlessly import and use any Java class. Except for some standard modules, Jython programs use Java classes instead of Python modules...
for the Python language).
JRuby's lead developers are Charles Nutter, Thomas Enebo, Ola Bini and Nick Sieger. In September 2006, Sun Microsystems
Sun Microsystems
Sun Microsystems, Inc. was a company that sold :computers, computer components, :computer software, and :information technology services. Sun was founded on February 24, 1982...
hired Enebo and Nutter to work on JRuby full time. In June 2007, ThoughtWorks
ThoughtWorks
ThoughtWorks is a privately owned global IT consultancy that delivers custom software, software tools, consulting, and transformation services to Global 1000 companies. It has a products division, ThoughtWorks Studios, which creates and markets software development and project management applications...
hired Ola Bini to work on Ruby and JRuby. In July 2009, the JRuby developers left Sun to continue JRuby development at Engine Yard
Engine Yard
Engine Yard is a San Francisco, California based company focused on Ruby on Rails deployment and management-Software development:One of Engine Yard's four founders, Ezra Zygmuntowicz, was the creator of the Merb project, and the company continued supporting the project by hiring Yehuda Katz to work...
.
History
JRuby was originally created by Jan Arne Petersen, in 2001. At that time and for several years following, the code was a direct port of the Ruby 1.6 CC (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
code. With the release of Ruby 1.8.6, an effort began to update JRuby to 1.8.6 features and semantics. Since 2001, several contributors have assisted the project, leading to the current core team of four members.
JRuby 1.1 added Just-in-time compilation
Just-in-time compilation
In computing, just-in-time compilation , also known as dynamic translation, is a method to improve the runtime performance of computer programs. Historically, computer programs had two modes of runtime operation, either interpreted or static compilation...
and Ahead-of-time compilation
AOT compiler
An ahead-of-time compiler is a compiler that implements ahead-of-time compilation. This refers to the act of compiling an intermediate language, such as Java bytecode, .NET Common Intermediate Language , or IBM System/38 or IBM System i "Technology Independent Machine Interface" code, into a...
modes to JRuby and was already faster in most cases than the current Ruby 1.8.7 reference implementation.
JRuby 1.1.1 is stated to be packaged in Fedora 9.
On July 2009, the core JRuby developers, Charles Nutter, Thomas Enebo and Nick Sieger, joined Engine Yard
Engine Yard
Engine Yard is a San Francisco, California based company focused on Ruby on Rails deployment and management-Software development:One of Engine Yard's four founders, Ezra Zygmuntowicz, was the creator of the Merb project, and the company continued supporting the project by hiring Yehuda Katz to work...
to continue JRuby development.
JRuby initially supported Ruby MRI
Ruby MRI
Matz's Ruby Interpreter or Ruby MRI is the reference implementation of the Ruby programming language. As there is currently no specification of the Ruby language, the MRI implementation is considered the de facto reference. The RubySpec project has created a large test suite that captures...
1.8.6. Since 1.4.0 it also supports Ruby 1.8.7, and since 1.6.0 it supports Ruby 1.9.2.
Ruby on Rails
JRuby supports Ruby on RailsRuby on Rails
Ruby on Rails, often shortened to Rails or RoR, is an open source web application framework for the Ruby programming language.-History:...
since version 0.9 (May 2006), with the ability to execute RubyGems
RubyGems
RubyGems is a package manager for the Ruby programming language that provides a standard format for distributing Ruby programs and libraries , a tool designed to easily manage the installation of gems, and a server for distributing them. It is analogous to EasyInstall for the Python programming...
and WEBrick
WEBrick
WEBrick is a Ruby library providing simple HTTP web server services. WEBrick was primarily written by Masayoshi Takahashi and Yuuzou Gotou, with contributions from other developers via the open source model of software development...
. Since the hiring of the two lead developers by Sun, Rails compatibility and speed have improved greatly. JRuby version 1.0 successfully passed nearly all of Rails' own test cases. Since then, developers have begun to use JRuby for Rails applications in production environments .
Multiple virtual machine collaboration
On February 27, 2008, Sun MicrosystemsSun Microsystems
Sun Microsystems, Inc. was a company that sold :computers, computer components, :computer software, and :information technology services. Sun was founded on February 24, 1982...
and the University of Tokyo
University of Tokyo
, abbreviated as , is a major research university located in Tokyo, Japan. The University has 10 faculties with a total of around 30,000 students, 2,100 of whom are foreign. Its five campuses are in Hongō, Komaba, Kashiwa, Shirokane and Nakano. It is considered to be the most prestigious university...
announced a joint-research project to implement a virtual machine capable of executing more than one Ruby
Ruby (programming language)
Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto...
or JRuby application on one interpreter.
Dynamic invocation on Java Virtual Machines
JSR 292 (Supporting Dynamically Typed Languages on the JavaTM Platform) propose to:- add a new
invokedynamic
instruction at the JVM level, to allow method invocation relying on dynamic type checking, - to be able to change the classes and methods at runtime dynamically in a production environment.
The Sun
Sun Microsystems
Sun Microsystems, Inc. was a company that sold :computers, computer components, :computer software, and :information technology services. Sun was founded on February 24, 1982...
Open source project Multi Language Virtual Machine
Da Vinci Machine
The Da Vinci Machine, also called the Multi Language Virtual Machine is a Sun Microsystems project aiming to prototype the extension of the Java Virtual Machine to add support for dynamic languages....
aim to prototype this JSR. The first working prototype, developed as a patch on OpenJDK
OpenJDK
OpenJDK is a free and open source implementation of the Java programming language. It is the result of an effort Sun Microsystems began in 2006...
, was announced and made available on end of August 2008.
The JRuby team has successfully wired dynamic invocation in their codebase, albeit in a very primitive way. Dynamic invocation shipped with the 1.1.5 release, although being disabled on JVM
Java Virtual Machine
A Java virtual machine is a virtual machine capable of executing Java bytecode. It is the code execution component of the Java software platform. Sun Microsystems stated that there are over 4.5 billion JVM-enabled devices.-Overview:...
s without Dynamic invocation capabilities.
Release history
This table presents only releases that present significant steps in JRuby history, aside from versions that mainly fixed bugs and improved performance. Performance improvements are also not shown in the table below, as every release has usually brought such improvements.The project gets coordinated here at codehaus.org,
you can find also the official release history resp. plan there.
Release | Release Date | Highlights |
---|---|---|
0.9 | 2006-08-01 | Rails support |
1.1 | 2008-03-28 | Performs better than Ruby MRI 1.8.7 AOT mode AOT compiler An ahead-of-time compiler is a compiler that implements ahead-of-time compilation. This refers to the act of compiling an intermediate language, such as Java bytecode, .NET Common Intermediate Language , or IBM System/38 or IBM System i "Technology Independent Machine Interface" code, into a... and JIT mode Just-in-time compilation In computing, just-in-time compilation , also known as dynamic translation, is a method to improve the runtime performance of computer programs. Historically, computer programs had two modes of runtime operation, either interpreted or static compilation... |
1.1.4 | 2008-08-28 | Refactored Java integration layer Beginning of Ruby 1.9 support FFI Foreign function interface A foreign function interface is a mechanism by which a program written in one programming language can call routines or make use of services written in another. The term comes from the specification for Common Lisp, which explicitly refers to the language features for inter-language calls as... subsystem for calling C C (programming language) C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system.... libraries |
1.2.0 | 2009-03-16 | JIT Just-in-time compilation In computing, just-in-time compilation , also known as dynamic translation, is a method to improve the runtime performance of computer programs. Historically, computer programs had two modes of runtime operation, either interpreted or static compilation... compiler for Ruby 1.9 Preliminary Android support |
1.3.0 | 2009-06-03 | JRuby runs in restricted environments better like GAE/J Google App Engine Google App Engine is a platform as a service cloud computing platform for developing and hosting web applications in Google-managed data centers. It virtualizes applications across multiple servers,... |
1.4.0 | 2009-11-02 | Windows Native Launcher and Windows installer Ruby 1.8.7 support |
1.5.0 | 2010-05-12 | Native Launcher for UNIX-based platforms Ant support and Rake-Ant integration Updates to the standard library, RubyGems, and RSpec |
1.6.0 | 2011-03-15 | Ruby 1.9.2 language and API compatibility Built-in profiler Experimental support for C extensions based on Ruby’s C API |
In March 2011, core JRuby developer Thomas Enebo said in an interview that the group was still in the planning stages of version 1.7, and expected to have several 1.6.x point releases before then. Features currently being planned include:
- Java 7 APIs including new concurrencyJava concurrencyThe Java language and the JVM have been designed to support concurrent programming, and all execution in takes place in the context of threads. Objects and resources can be accessed by many separate threads; each thread has its own path of execution but can potentially access any object in the...
and collectionsJava collections frameworkThe Java collections framework is a set of classes and interfaces that implement commonly reusable collection data structures.Although it is a framework, it works in a manner of a library...
APIs - a new internal representation format that will allow more optimizations at Ruby-level, alongside the JVM
- modularizationModular programmingModular programming is a software design technique that increases the extent to which software is composed of separate, interchangeable components called modules by breaking down program functions into modules, each of which accomplishes one function and contains everything necessary to accomplish...
, to make all core types and native extensions to be included or excluded based on a profile, allowing developers to build a subset of JRuby's source - Packaging decoupling, allowing developers to inclusion and exclusion of components from their resulting JAR file
Design
Since early 2006, the current JRuby core team has endeavored to move JRuby beyond being a simple C port, to support better performance and to aid eventual compilation to Java bytecode. To support this end, the team set an ambitious goal: to be able to run Ruby on RailsRuby on Rails
Ruby on Rails, often shortened to Rails or RoR, is an open source web application framework for the Ruby programming language.-History:...
unmodified using JRuby. In the process of achieving this goal, the JRuby test suite expanded to such extent that the team gained confidence in the "correctness" of JRuby. As a result, toward the end of 2006 and in the beginning of 2007, they began to commit much more complicated redesigns and refactorings of JRuby's core subsystems.
JRuby is designed to work as a mixed-mode virtual machine for Ruby, where code can be either interpreted directly, just-in-time
Just-in-time compilation
In computing, just-in-time compilation , also known as dynamic translation, is a method to improve the runtime performance of computer programs. Historically, computer programs had two modes of runtime operation, either interpreted or static compilation...
compiled at runtime to Java bytecode, or ahead-of-time
AOT compiler
An ahead-of-time compiler is a compiler that implements ahead-of-time compilation. This refers to the act of compiling an intermediate language, such as Java bytecode, .NET Common Intermediate Language , or IBM System/38 or IBM System i "Technology Independent Machine Interface" code, into a...
compiled to Java bytecode before execution. Until October 2007, only the interpreted
Interpreter (computing)
In computer science, an interpreter normally means a computer program that executes, i.e. performs, instructions written in a programming language...
mode supported all Ruby's constructs, but a full AOT
AOT compiler
An ahead-of-time compiler is a compiler that implements ahead-of-time compilation. This refers to the act of compiling an intermediate language, such as Java bytecode, .NET Common Intermediate Language , or IBM System/38 or IBM System i "Technology Independent Machine Interface" code, into a...
/JIT
Just-in-time compilation
In computing, just-in-time compilation , also known as dynamic translation, is a method to improve the runtime performance of computer programs. Historically, computer programs had two modes of runtime operation, either interpreted or static compilation...
compiler is available since version 1.1. The compiler design allows for interpreted and compiled code to run side-by-side, as well as decompilation to reoptimize and outputting generated bytecode
Java bytecode
Java bytecode is the form of instructions that the Java virtual machine executes. Each bytecode opcode is one byte in length, although some require parameters, resulting in some multi-byte instructions. Not all of the possible 256 opcodes are used. 51 are reserved for future use...
as Java class files.
JRuby is commercially supported by Engine Yard
Engine Yard
Engine Yard is a San Francisco, California based company focused on Ruby on Rails deployment and management-Software development:One of Engine Yard's four founders, Ezra Zygmuntowicz, was the creator of the Merb project, and the company continued supporting the project by hiring Yehuda Katz to work...
. It uses Unicode natively. It offers access to the large ecosystem of Java libraries, using Ruby syntax. Java application servers like GlassFish
GlassFish
GlassFish is an open source application server project started by Sun Microsystems for the Java EE platform and now sponsored by Oracle Corporation. The supported version is called Oracle GlassFish Server...
can be used to run JRuby applications at enterprise scale.
Frameworks support
JRuby has built-in support for RailsRuby on Rails
Ruby on Rails, often shortened to Rails or RoR, is an open source web application framework for the Ruby programming language.-History:...
, RSpec
RSpec
RSpec is a behavior driven development framework for the Ruby programming language, inspired by JBehave. It contains its own mocking framework that is fully integrated into the framework based upon JMock...
, Rake
Rake (software)
Rake is a software task management tool. It allows you to specify tasks and describe dependencies as well as to group tasks in a namespace.It is similar to SCons and make, but has a number of differences. The tool is written in the Ruby programming language, and the Rakefiles use Ruby syntax...
, and RubyGems
RubyGems
RubyGems is a package manager for the Ruby programming language that provides a standard format for distributing Ruby programs and libraries , a tool designed to easily manage the installation of gems, and a server for distributing them. It is analogous to EasyInstall for the Python programming...
. It embeds an FFI
Foreign function interface
A foreign function interface is a mechanism by which a program written in one programming language can call routines or make use of services written in another. The term comes from the specification for Common Lisp, which explicitly refers to the language features for inter-language calls as...
subsystem to allow to use C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
libraries bundled as gems
RubyGems
RubyGems is a package manager for the Ruby programming language that provides a standard format for distributing Ruby programs and libraries , a tool designed to easily manage the installation of gems, and a server for distributing them. It is analogous to EasyInstall for the Python programming...
. It also allows launching the Interactive Ruby Shell
Interactive Ruby Shell
Interactive Ruby Shell is a shell for programming in the object-oriented scripting language Ruby. The program is launched from a command line and allows the execution of Ruby commands with immediate response, experimenting in real-time...
(irb) as Ruby MRI
Ruby MRI
Matz's Ruby Interpreter or Ruby MRI is the reference implementation of the Ruby programming language. As there is currently no specification of the Ruby language, the MRI implementation is considered the de facto reference. The RubySpec project has created a large test suite that captures...
does.
The Netbeans Ruby Pack, available since NetBeans 6.0, allows IDE development with Ruby
Ruby (programming language)
Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto...
and JRuby, as well as Ruby on Rails
Ruby on Rails
Ruby on Rails, often shortened to Rails or RoR, is an open source web application framework for the Ruby programming language.-History:...
for the two implementations of Ruby.
Ruby meets Java
JRuby is essentially the Ruby interpreter, except this version is written entirely in JavaJava (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
. JRuby features some of the same concepts, including object-oriented programming
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...
, and dynamic-typing as Ruby. The key difference is that JRuby is tightly integrated with Java, and can be called directly from Java programs. Java has significant footing in the development of web applications.
JRuby calling Java
One powerful feature of JRuby is its ability to invoke the classes of the Java Platform. To do this, one must first load JRuby's Java support, by calling "require 'java'". The following example creates a Java with a :JRuby also allows the user to call Java code using the more Ruby-like underscore method naming and to refer to JavaBean properties as attributes:
Calling JRuby from Java
JRuby can just as easily be called from Java, using either the JSR 223 Scripting for Java 6 or the Apache Bean ScriptingBean Scripting Framework
The Bean Scripting Framework is a method of allowing the use of scripting in Java code. It provides a set of Java classes which provides support within Java applications for scripting languages, and also allows access to Java objects and methods...
framework. More information on this is available in the JRuby Wiki article.
Performance
JRuby supports interpreted modeInterpreted language
Interpreted language is a programming language in which programs are 'indirectly' executed by an interpreter program. This can be contrasted with a compiled language which is converted into machine code and then 'directly' executed by the host CPU...
, AOT mode
AOT compiler
An ahead-of-time compiler is a compiler that implements ahead-of-time compilation. This refers to the act of compiling an intermediate language, such as Java bytecode, .NET Common Intermediate Language , or IBM System/38 or IBM System i "Technology Independent Machine Interface" code, into a...
, and JIT mode
Just-in-time compilation
In computing, just-in-time compilation , also known as dynamic translation, is a method to improve the runtime performance of computer programs. Historically, computer programs had two modes of runtime operation, either interpreted or static compilation...
(the last two modes are available since version 1.1). JRuby evolved from being several times slower than Ruby Reference implementation
Ruby MRI
Matz's Ruby Interpreter or Ruby MRI is the reference implementation of the Ruby programming language. As there is currently no specification of the Ruby language, the MRI implementation is considered the de facto reference. The RubySpec project has created a large test suite that captures...
, to being several times faster.
Benchmarks as of 16 December 2009, show JRuby using between 2 and 56 times the memory of Ruby MRI.
JRuby developer Charles Nutter claims that Java JDK7 gives a performance boost to JRuby, saying "On bench_threaded_reverse, Java 7 is 20% faster than Java 6, and JRuby plus invokedynamic is 20% faster than that".https://twitter.com/#!/headius/status/78282122997149696
Interpreted mode
In this mode, JRuby 1.0 was slower than the C Ruby reference. For example, serving up Rails requests in the standard interpreted modeInterpreted language
Interpreted language is a programming language in which programs are 'indirectly' executed by an interpreter program. This can be contrasted with a compiled language which is converted into machine code and then 'directly' executed by the host CPU...
, JRuby was 50% to 70% slower than C Ruby 1.8
Ruby MRI
Matz's Ruby Interpreter or Ruby MRI is the reference implementation of the Ruby programming language. As there is currently no specification of the Ruby language, the MRI implementation is considered the de facto reference. The RubySpec project has created a large test suite that captures...
. Since then, JRuby performance in interpreted mode has improved a lot. The JRuby team claims that JRuby 1.1.4 is 15%-20% faster in interpreted mode than Ruby MRI
Ruby MRI
Matz's Ruby Interpreter or Ruby MRI is the reference implementation of the Ruby programming language. As there is currently no specification of the Ruby language, the MRI implementation is considered the de facto reference. The RubySpec project has created a large test suite that captures...
.
When using Ruby 1.9 (YARV
YARV
YARV is a bytecode interpreter that was developed for the Ruby programming language by Koichi Sasada. The goal of the project was to greatly reduce the execution time of Ruby programs....
) benchmarks on Java 6
Java Platform, Standard Edition
Java Platform, Standard Edition or Java SE is a widely used platform for programming in the Java language. It is the Java Platform used to deploy portable applications for general use...
, interpreted JRuby 1.0 was 4 times slower than Ruby (including startup time).
Just-in-time compilation mode
JIT modeJust-in-time compilation
In computing, just-in-time compilation , also known as dynamic translation, is a method to improve the runtime performance of computer programs. Historically, computer programs had two modes of runtime operation, either interpreted or static compilation...
is available since JRuby 1.1. In performance benchmarks, JRuby 1.6.3 version outperforms C Ruby 1.9
Ruby MRI
Matz's Ruby Interpreter or Ruby MRI is the reference implementation of the Ruby programming language. As there is currently no specification of the Ruby language, the MRI implementation is considered the de facto reference. The RubySpec project has created a large test suite that captures...
in most cases.
Also in a real Mongrel web server
Web server
Web server can refer to either the hardware or the software that helps to deliver content that can be accessed through the Internet....
application, JRuby performance is better than Ruby (after the Virtual Machine
Java Virtual Machine
A Java virtual machine is a virtual machine capable of executing Java bytecode. It is the code execution component of the Java software platform. Sun Microsystems stated that there are over 4.5 billion JVM-enabled devices.-Overview:...
has instantiated).
Any implementation is usually noted for its speed. According to some benchmarks, JRuby is faster when compared to other implementations as noted above. Keep in mind the Java virtual machine takes time to load, too, but this is taken out of consideration.
See also
- JythonJythonJython, successor of JPython, is an implementation of the Python programming language written in Java.-Overview:Jython programs can seamlessly import and use any Java class. Except for some standard modules, Jython programs use Java classes instead of Python modules...
- YARVYARVYARV is a bytecode interpreter that was developed for the Ruby programming language by Koichi Sasada. The goal of the project was to greatly reduce the execution time of Ruby programs....
- ZK (framework)ZK (framework)ZK is an open-source Ajax Web application framework, written in Java, that enables creation of rich graphical user interfaces for Web applications with no JavaScript and little programming knowledge....
– an Ajax framework supporting JRuby - Monkeybars FrameworkMonkeybars FrameworkMonkeybars is a library that provides a structured way of building Swing applications using JRuby. Although Monkeybars uses the ideas of models, views, and controllers, its usage of the terms is not the same as in traditional MVC systems...
- Da Vinci MachineDa Vinci MachineThe Da Vinci Machine, also called the Multi Language Virtual Machine is a Sun Microsystems project aiming to prototype the extension of the Java Virtual Machine to add support for dynamic languages....