Is it possible to substantially increase Ruby’s execution speed by
compiling it to an EXE file?
I think I heard about a project somewhere that’s like Jython, which
can compile Ruby to Java bytecode. If that exists, then, one could
compile the Java bytecode to an optimized native executable using GCJ
or another commercial Java bytecode to EXE tool.
Does this exist? If so, how well/fast does it work?
Hi,
Is it possible to substantially increase Ruby’s execution speed by
compiling it to an EXE file?
There were rb2c (ruby to C translator) and rbjit (ruby JIT),
but they’ve not been maintained so long.
I think I heard about a project somewhere that’s like Jython, which
can compile Ruby to Java bytecode. If that exists, then, one could
compile the Java bytecode to an optimized native executable using GCJ
or another commercial Java bytecode to EXE tool.
AFAIK, Jython is an implementation of Python by Java, and
doesn’t compile the source to bytecode. Also JRuby is similar.
···
At Thu, 2 Jan 2003 09:57:54 +0900, Philip Mak wrote:
–
Nobu Nakada
Is it possible to substantially increase Ruby’s execution speed by
compiling it to an EXE file?
Execution speed will not be increased very much by this method.
The binary executable will still contain a copy of the ruby interpreter
which will run the ruby code much the same way as the original.
I think I heard about a project somewhere that’s like Jython, which can
compile Ruby to Java bytecode. If that exists, then, one could compile
the Java bytecode to an optimized native executable using GCJ or another
commercial Java bytecode to EXE tool.
It’s called JRuby. It’s not a Ruby-to-Java compiler, but a ruby
interpreter written in Java.
Even if you compiled to Java:
- Java is not very fast anyways.
- Compiling Java to an executable has the same problems I described above.
Do not despair, for there is yet one alternative:
Most programs follow the 80/20 rule. That is, 80% of the time is spent in
20% of the code. If this is your situation, you can optimize the
time-critical portion of your code by writing it in C, and making it a
ruby extension. This portion of the code will run at the original C
speed. Depending on the problem at hand, you might see dramatic
improvements in execution.
I’ve glanced at the Ruby API, and it looks very easy to use. I suggest
you consider this option.
Cheers,
Daniel.
Jython actually has a bytecode compiler available.
We plan to create one for JRuby too, in our copious free time.
/Anders
···
nobu.nokada@softhome.net wrote:
AFAIK, Jython is an implementation of Python by Java, and
doesn’t compile the source to bytecode. Also JRuby is similar.
–
A n d e r s B e n g t s s o n | ndrsbngtssn@yahoo.se
Stockholm, Sweden |
Gratis e-mail resten av livet på www.yahoo.se/mail
Busenkelt!
“Anders Bengtsson” ndrsbngtssn@yahoo.se wrote in message
We plan to create one for JRuby too, in our copious free time.
Mean while, Matz is working on his little secret compiler ([57771],[58028])
(Guess which: Squeak ? Scheme-48? Parrot? gforth? ;-))
Just wait and see …
– shanko