Compiled version of Ruby

Discussion in 'Ruby' started by zero, Nov 2, 2005.

  1. zero

    zero Guest

    I know this has been discussed before but I would like to know if
    anything has changed in the past 2 years and if anything is on the
    horizon that would allow either byte compilation of Ruby (like Python)
    or <dreaming> native compilation </dreaming>.

    Ruby is cool, but I don't want to use it for anything I am likely to
    install on a user's machine because (1) I often don't want users to
    muck with my code, and (2) sometimes I don't want them to (easily) see
    my code. I know that C#/Java can easily be reverse engineered, but
    knowing that someone would have to go to such lengths to get to my code
    is enough of a barrier to make me want to use one of those languages
    over Ruby even though I have to write three times as much code for the
    same task.

    Don't get me wrong, I love Ruby, I'm not a troll. I'm porting a site
    to Rails...so I have a strong predisposition to advocate Ruby for all
    things server-side. I just want to be able to use Ruby in the space
    where compiled languages tend to travel better than interpreted. I
    want to use Ruby for everything and would if I could just get byte
    compilation.

    -
    ed
    zero, Nov 2, 2005
    #1
    1. Advertising

  2. zero

    gregarican Guest

    zero wrote:

    > I know this has been discussed before but I would like to know if
    > anything has changed in the past 2 years and if anything is on the
    > horizon that would allow either byte compilation of Ruby (like Python)
    > or <dreaming> native compilation </dreaming>.


    Have you checked out YARV? See http://www.atdot.net/yarv/ for details...
    gregarican, Nov 2, 2005
    #2
    1. Advertising

  3. On Nov 2, 2005, at 3:12 PM, zero wrote:

    > Ruby is cool, but I don't want to use it for anything I am likely to
    > install on a user's machine because (1) I often don't want users to
    > muck with my code, and (2) sometimes I don't want them to (easily) see
    > my code. I know that C#/Java can easily be reverse engineered, but
    > knowing that someone would have to go to such lengths to get to my
    > code
    > is enough of a barrier to make me want to use one of those languages
    > over Ruby even though I have to write three times as much code for the
    > same task.


    I know this isn't exactly what you asked for, but if you just need a
    minor deterrent, perhaps a hack along the lines of http://
    www.rubyquiz.com/quiz34.html would work. Just a thought.

    James Edward Gray II
    James Edward Gray II, Nov 2, 2005
    #3
  4. zero

    Kevin Brown Guest

    On Wednesday 02 November 2005 15:12, zero wrote:
    > I
    > want to use Ruby for everything and would if I could just get byte
    > compilation.


    Ruby 2.0 will be byte compiled. Take a look at YARV.

    http://www.atdot.net/yarv/

    This will be the VM for Ruby 2.0, Matz has already declared.
    Kevin Brown, Nov 2, 2005
    #4
  5. Kevin Brown ha scritto:
    > On Wednesday 02 November 2005 15:12, zero wrote:
    >
    >> I
    >>want to use Ruby for everything and would if I could just get byte
    >>compilation.

    >
    >
    > Ruby 2.0 will be byte compiled. Take a look at YARV.
    >
    > http://www.atdot.net/yarv/
    >
    > This will be the VM for Ruby 2.0, Matz has already declared.
    >
    >

    notice that is planned for yarv to even support translation to C, and
    that some basic functionality for this is already available
    gabriele renzi, Nov 3, 2005
    #5
  6. zero

    zero Guest

    "notice that is planned for yarv to even support translation to C, and
    that some basic functionality for this is already available"

    OK, things are heating up.

    It sounds like the Gabmit Scheme approach. Will 'yarv' output ansi C
    which we can then run through a C compiler of our choice?

    Are there any gcc front ends planned?

    Thanks for your post, this is fantastic news.

    -
    e
    zero, Nov 3, 2005
    #6
  7. zero

    Eric Hodel Guest

    On Nov 2, 2005, at 1:12 PM, zero wrote:

    > I know this has been discussed before but I would like to know if
    > anything has changed in the past 2 years and if anything is on the
    > horizon that would allow either byte compilation of Ruby (like Python)
    > or <dreaming> native compilation </dreaming>.
    >
    > Ruby is cool, but I don't want to use it for anything I am likely to
    > install on a user's machine because (1) I often don't want users to
    > muck with my code, and (2) sometimes I don't want them to (easily) see
    > my code. I know that C#/Java can easily be reverse engineered, but
    > knowing that someone would have to go to such lengths to get to my
    > code
    > is enough of a barrier to make me want to use one of those languages
    > over Ruby even though I have to write three times as much code for the
    > same task.


    ZenObfuscator can compile a Ruby program to C.

    It has not been released.

    --
    Eric Hodel - - http://segment7.net
    FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04
    Eric Hodel, Nov 3, 2005
    #7
  8. zero

    Stefan Lang Guest

    On Thursday 03 November 2005 19:22, zero wrote:
    > "notice that is planned for yarv to even support translation to C,
    > and that some basic functionality for this is already available"
    >
    > OK, things are heating up.
    >
    > It sounds like the Gabmit Scheme approach. Will 'yarv' output ansi
    > C which we can then run through a C compiler of our choice?
    >
    > Are there any gcc front ends planned?
    >
    > Thanks for your post, this is fantastic news.


    I wouldn't be to euphoric. I don't think it will be ever possible
    to convert a Ruby program to C code that doesn't depend on a Ruby
    interpreter.
    Extreme example: eval

    If it would be possible, Ruby were just C with different syntax.

    Regards,
    Stefan
    Stefan Lang, Nov 3, 2005
    #8
  9. Stefan Lang ha scritto:
    > On Thursday 03 November 2005 19:22, zero wrote:
    >
    >>"notice that is planned for yarv to even support translation to C,
    >>and that some basic functionality for this is already available"
    >>
    >>OK, things are heating up.
    >>
    >>It sounds like the Gabmit Scheme approach. Will 'yarv' output ansi
    >>C which we can then run through a C compiler of our choice?
    >>
    >>Are there any gcc front ends planned?
    >>
    >>Thanks for your post, this is fantastic news.

    >
    >
    > I wouldn't be to euphoric. I don't think it will be ever possible
    > to convert a Ruby program to C code that doesn't depend on a Ruby
    > interpreter.
    > Extreme example: eval
    > If it would be possible, Ruby were just C with different syntax.


    yes, AFAIK, the ruby->c translation just spits out a C library that you
    can use in your code to get a great speedup (and some obfuscation).

    Anyway, I think it would be possible to avoid depending on an
    interpreter, following the same approach other compilers for dynamic
    languages do: depend on a library (just like libruby) and compile it
    directly in the executable.
    gabriele renzi, Nov 3, 2005
    #9
  10. On 11/2/05, zero <> wrote:
    > I know this has been discussed before but I would like to know if
    > anything has changed in the past 2 years and if anything is on the
    > horizon that would allow either byte compilation of Ruby (like Python)
    > or <dreaming> native compilation </dreaming>.


    You might want to check out the 'ruby2c' project. It is still in beta-land=
    ,
    but with it you could at least translate some ruby that you write into C
    code, and then run that in combination with standard ruby.

    http://rubyforge.org/projects/ruby2c/

    (disclaimer: I have not tried ruby2c, I just think it is an interesting and
    worthwhile project)

    --
    Garance Alistair Drosehn =3D
    Senior Systems Programmer or
    Rensselaer Polytechnic Institute; Troy, NY; USA
    Garance A Drosehn, Nov 4, 2005
    #10
  11. zero

    Dean Wampler Guest

    Bruce Tate in his book "Beyond Java" argues that Ruby would benefit a
    lot if it ran on top of the Java VM, e.g., the JRuby project. The
    benefits would include years of effort to optimize performance and
    easy access to Java libraries. On the other hand, a Ruby-specific VM
    could be tuned for the specifics of the language.

    Has anyone analyzed the pros and cons of these two approaches?


    On 11/2/05, Kevin Brown <> wrote:
    > On Wednesday 02 November 2005 15:12, zero wrote:
    > > I
    > > want to use Ruby for everything and would if I could just get byte
    > > compilation.

    >
    > Ruby 2.0 will be byte compiled. Take a look at YARV.
    >
    > http://www.atdot.net/yarv/
    >
    > This will be the VM for Ruby 2.0, Matz has already declared.
    >
    >



    --
    Dean Wampler
    http://www.aspectprogramming.com
    http://www.newaspects.com
    http://www.contract4j.org
    Dean Wampler, Nov 4, 2005
    #11
  12. Dean Wampler ha scritto:
    > Bruce Tate in his book "Beyond Java" argues that Ruby would benefit a
    > lot if it ran on top of the Java VM, e.g., the JRuby project. The
    > benefits would include years of effort to optimize performance and
    > easy access to Java libraries. On the other hand, a Ruby-specific VM
    > could be tuned for the specifics of the language.
    >
    > Has anyone analyzed the pros and cons of these two approaches?


    I think that there asre still issues for a ruby interpreter running on
    top of the jvm (I'm thinking of HotSpot here) or any other VM designed
    for static languages, since some ruby features would run suboptimally on
    it.

    Think for example of IronPython: it runs faster than CPython on the .net
    VM (CLR,which is similar to the jvm) for some benchmarks, and this is a
    great goal.
    But it is still tens of times slower than C# on the same runtime, since
    the VM does not provide mechanisms aimed at optimizing a language like
    python (or ruby).

    Anyway it is worth noting that SUN seem to be thinking of fixing some of
    the issues, see for example the news about a new opcode "invokedynamic"
    which is specifically thought to speed up dispatch in dynamically typed
    languages.
    gabriele renzi, Nov 4, 2005
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. marcus
    Replies:
    0
    Views:
    346
    marcus
    Jun 6, 2004
  2. Klaus Schneider
    Replies:
    1
    Views:
    530
    Rolf Magnus
    Dec 2, 2004
  3. V Green
    Replies:
    0
    Views:
    829
    V Green
    Feb 5, 2008
  4. PA Bear [MS MVP]
    Replies:
    0
    Views:
    932
    PA Bear [MS MVP]
    Feb 5, 2008
  5. mdev
    Replies:
    0
    Views:
    1,585
Loading...

Share This Page