Difference between Ruby and JRuby

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Difference between Ruby and JRuby

Alex jimmy Montaño fuentes
Hi,

Can anyone tell me what is the difference between ruby and jruby?

I have read that JRuby means, java implementation of Ruby. What does
that mean? Is it mean that ruby interpretor is written in java?

Also, Is all ruby API methods are available in JRuby? like array, hash
etc.

Thanks,
Mike.

--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Difference between Ruby and JRuby

Jeffrey Jones-7
The essential difference is that JRuby compiles down to Java byte-code
and is executed on the Java Virtual Machine. MRI uses it's own interpreter.

This of course means you need Java installed on your system.

JRuby when used in 1.8.7 mode is fully api compatible with MRI ruby.
JRuby when used in 1.9.2 is pretty close to full API compatibility I
think, not totally sure.

There may be a few gems that give you trouble on JRuby but they are few
and far between.

On 05/08/11 14:54, Mike Disuza wrote:

> Hi,
>
> Can anyone tell me what is the difference between ruby and jruby?
>
> I have read that JRuby means, java implementation of Ruby. What does
> that mean? Is it mean that ruby interpretor is written in java?
>
> Also, Is all ruby API methods are available in JRuby? like array, hash
> etc.
>
> Thanks,
> Mike.
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Difference between Ruby and JRuby

Alex jimmy Montaño fuentes
Thanks Jeffrey for your instant reply.
This means that I can write the ruby code as it is which will be
interpreted by JVM and everything will be same.

Jeffrey Jones wrote in post #1015074:

> The essential difference is that JRuby compiles down to Java byte-code
> and is executed on the Java Virtual Machine. MRI uses it's own
> interpreter.
>
> This of course means you need Java installed on your system.
>
> JRuby when used in 1.8.7 mode is fully api compatible with MRI ruby.
> JRuby when used in 1.9.2 is pretty close to full API compatibility I
> think, not totally sure.
>
> There may be a few gems that give you trouble on JRuby but they are few
> and far between.

--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Re: Difference between Ruby and JRuby

Jeffrey Jones-7
In terms of what you write, there is no difference, it is all ruby. The
magic happens further down.

It is only when you start to take advantage of JRuby's unique features
(such as linking with java libraries) that your code really stops being
portable between MRI and JRuby

If you are on a *nix system the best way to give JRuby a try is to
install the Ruby Version Manager, use that to install JRuby then run
some of your scripts / applications ( Have a look at
http://jruby.org/getting-started ).


On 05/08/11 15:11, Mike Disuza wrote:

> Thanks Jeffrey for your instant reply.
> This means that I can write the ruby code as it is which will be
> interpreted by JVM and everything will be same.
>
> Jeffrey Jones wrote in post #1015074:
>> The essential difference is that JRuby compiles down to Java byte-code
>> and is executed on the Java Virtual Machine. MRI uses it's own
>> interpreter.
>>
>> This of course means you need Java installed on your system.
>>
>> JRuby when used in 1.8.7 mode is fully api compatible with MRI ruby.
>> JRuby when used in 1.9.2 is pretty close to full API compatibility I
>> think, not totally sure.
>>
>> There may be a few gems that give you trouble on JRuby but they are few
>> and far between.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Difference between Ruby and JRuby

Alex jimmy Montaño fuentes
In reply to this post by Alex jimmy Montaño fuentes
Thanks a lot Jeffrey.

--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Difference between Ruby and JRuby

Alex jimmy Montaño fuentes
In reply to this post by Alex jimmy Montaño fuentes
Hi,

      I have ruby on rails app with me.Now I wanna integrate my app with
JRuby in order to get asynchronous feature.How do I approach?
      Any help would be greatly appreciated,thanks in advance

--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Difference between Ruby and JRuby

Hassan Schroeder-2
On Fri, Nov 29, 2013 at 5:38 AM, Sathish R. <[hidden email]> wrote:

>       I have ruby on rails app with me.Now I wanna integrate my app with
> JRuby in order to get asynchronous feature.How do I approach?

First, don't start by "replying" to a 2+ year old thread; start a new topic.

Second, just run your app with JRuby. If you have specific problems,
ask about them and provide details.

--
Hassan Schroeder ------------------------ [hidden email]
http://about.me/hassanschroeder
twitter: @hassan

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Difference between Ruby and JRuby

Alex jimmy Montaño fuentes
In reply to this post by Alex jimmy Montaño fuentes
Thanks for the information.

--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Difference between Ruby and JRuby

keithrbennett
In reply to this post by Alex jimmy Montaño fuentes
Sathish -

Welcome to this group.

I'm wondering if your expectations of JRuby are realistic.  What exactly do you mean by asynchronous?  Are you referring to JRuby's superior threading?  What specifically are you trying to improve?  Have you identified a problem?

I strongly recommend the JRuby book: http://pragprog.com/book/jruby/using-jruby

- Keith


On Fri, Nov 29, 2013 at 8:38 AM, Sathish R. <[hidden email]> wrote:
Hi,

      I have ruby on rails app with me.Now I wanna integrate my app with
JRuby in order to get asynchronous feature.How do I approach?
      Any help would be greatly appreciated,thanks in advance

--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: Re: Difference between Ruby and JRuby

Alex jimmy Montaño fuentes
Thanks Keith for the reply.
           Let me explain my scenario.Am basically a java programmer.One
of my client had ruby on rails app(prior to 3.9 version) with him.He
approached me and asked
to convert his existing ruby on rails app to asynchronous.He himself
suggested ,do it with Play framework.
            When I raise this question with Play experts,they suggested
me to go with JRuby.Since then I have set up Jruby in my machine and
made my trails.But I could not get rid of it.
            Please suggest me ,how do I go with little detail
explanation.
            Thanks you very much.



-Sathish Reddy

--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Re: Difference between Ruby and JRuby

keithrbennett
Sathish -

I wish you well, but to be honest, it sounds like you’ll need more assistance than what can be provided here.  In addition, although you reiterated your request for help, you didn’t answer any of the questions I raised to help us help you.  In addition, you were asked to be more specific in your questions.

- Keith


On Dec 2, 2013, at 1:40 AM, Sathish R. <[hidden email]> wrote:

> Thanks Keith for the reply.
>           Let me explain my scenario.Am basically a java programmer.One
> of my client had ruby on rails app(prior to 3.9 version) with him.He
> approached me and asked
> to convert his existing ruby on rails app to asynchronous.He himself
> suggested ,do it with Play framework.
>            When I raise this question with Play experts,they suggested
> me to go with JRuby.Since then I have set up Jruby in my machine and
> made my trails.But I could not get rid of it.
>            Please suggest me ,how do I go with little detail
> explanation.
>            Thanks you very much.
>
>
>
> -Sathish Reddy
>
> --
> Posted via http://www.ruby-forum.com/.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Difference between Ruby and JRuby

Alex jimmy Montaño fuentes
Keith,
    Thanks for taking time to look at it.I agree that I did not answer
your questions,since I was not aware much about JRuby superior
threading and other kind of stuff.

-Sathish

--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Difference between Ruby and JRuby

Eric West

@Sathish ,

I would strongly encourage you to do two things:

  1. Read Using JRuby . You can work though it quickly and the examples and material contained in it will give you some ideas about how you can use JRuby to improve the performance of your client’s app. You might also want to check out Deploying JRuby as it has a lot of useful information about some of the main deployment options.

  2. Spend some time reading through articles on the JRuby wiki as they should provide a way to deepen the knowledge gleaned from the book, without requiring you to spend too much time on any of them.

This should give you a better idea about JRuby, and the how and why it is typically used by other developers. This video, Why JRuby Works summarizes some of this reasoning as well, and might be an even better starter point.

It might be the case that you could switch the rails app to JRuby, have it run with very few changes, and get an immediate performance boost simply due to JRuby’s better performance. The material I recommended will assuredly instruct you in how to do this.

As for going asynchronous, it might be possible to use the Play framework, via JRuby, to build an asynchronous application. I don’t know of anyone who has done that, personally, although it has probably been tried. You cannot just take a rails app, suddenly slap in JRuby and Play and have it be “asynchronous” however. Rails and Play are each frameworks in their own right, and I’m not even sure where one would begin to hook them together.

Usually, when people talk about asynchronous code in conjunction with Rails, they mean running selected parts of the Rails stack in an asynchronous way. Typically I/O heavy parts. Most often, they mean running it with an asynchronous server.

The two libraries most typically used to do async programming in Ruby are EventMachine and Celluloid, specifically Celluloid I/O. Of those two, I’d most highly recommend Celluloid, for many reasons, but especially because it doesn’t just give you Celluloid I/O for writing asynchronous code, but instead Celluloid provides an entire concurrency toolkit built around the Actor model. (Play framework is also built on top of the Actor model abstraction, but I believe Play hides this all from you instead of making it available to the end user).

Probably your easiest option for adding some async sauce to a Rails app would be to swap out the server for one written with one of those two libraries I mentioned above. I’d suggest Reel. That said, you might get better improvements just switching to JRuby for the native threading capability and then using something like Puma which is specifically intended for use in Rack applications like those built with Rails, or one of the other deployment options recommended in the book I mentioned. TorqueBox would be another great choice.

It will depend on your clients use case, and you should definitely try several things and do some benchmarking.



On Wed, Dec 4, 2013 at 6:04 AM, Sathish R. <[hidden email]> wrote:
Keith,
    Thanks for taking time to look at it.I agree that I did not answer
your questions,since I was not aware much about JRuby superior
threading and other kind of stuff.

-Sathish

--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: Re: Difference between Ruby and JRuby

Eric Christopherson
In reply to this post by Alex jimmy Montaño fuentes
On Mon, Dec 2, 2013 at 12:40 AM, Sathish R. <[hidden email]> wrote:
Thanks Keith for the reply.
           Let me explain my scenario.Am basically a java programmer.One
of my client had ruby on rails app(prior to 3.9 version) with him.He
approached me and asked
to convert his existing ruby on rails app to asynchronous.He himself
suggested ,do it with Play framework.
            When I raise this question with Play experts,they suggested
me to go with JRuby.Since then I have set up Jruby in my machine and
made my trails.But I could not get rid of it.
            Please suggest me ,how do I go with little detail
explanation.
            Thanks you very much.

It sounds to me like your client wanted his existing code ported to Play (presumably using Java or Scala).
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Difference between Ruby and JRuby

Alex jimmy Montaño fuentes
In reply to this post by Eric West
-Eric West

           Thank you so much for elaborated explanation.I will follow
the steps suggested by you,hope would find the solution.


-Sathish

--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email