Ruby speed comparison

M

Markus Hillbrand

Hello,

I want to use ruby as an embedded scripting language within a c++ server. As
an alternative to ruby I also took a look on python. I noticed that it is
possible to precompile scripts in python and run them later without the need
to recompile the script. As I didn't find the same possibility within the
ruby C-API I'm worrying about the speed penalties if I use ruby.
So is it possible to precompile a ruby script (I don't want to have an .exe
I want to have something like a precompiled .jar oder .class from java)?
If this isn't possible the question is if ruby isn't too slow for my usage
because I plan to use the scripting language very frequently within the
program. Are there any performance benchmarks available?

Thanks in advance,
Markus
 
G

gabriele renzi

il Sun, 19 Oct 2003 20:57:58 +0900, "Markus Hillbrand"
Hello,

I want to use ruby as an embedded scripting language within a c++ server. As
an alternative to ruby I also took a look on python. I noticed that it is
possible to precompile scripts in python and run them later without the need
to recompile the script. As I didn't find the same possibility within the
ruby C-API I'm worrying about the speed penalties if I use ruby.
So is it possible to precompile a ruby script (I don't want to have an .exe
I want to have something like a precompiled .jar oder .class from java)?

it is not possible AFAIK, it will be with the next major release (2.0
aka rite)

If this isn't possible the question is if ruby isn't too slow for my usage
because I plan to use the scripting language very frequently within the
program. Are there any performance benchmarks available?

again, AFAIK ruby is slower than python in some benchamrks (i.e.
google for 'great language shootout'). It may be faster in others.
I don't think there is a *recent* and complete benchmark/comparison of
the two.

But, I don't think this would a problem for you. I don't think that
you're planning to use $the_script_language so extensive that you
could notice differences of this kind..

I think you may even take a look at lua..
(just my 2c)
 
R

Robert Klemme

Markus Hillbrand said:
Hello,

I want to use ruby as an embedded scripting language within a c++ server. As
an alternative to ruby I also took a look on python. I noticed that it is
possible to precompile scripts in python and run them later without the need
to recompile the script. As I didn't find the same possibility within the
ruby C-API I'm worrying about the speed penalties if I use ruby.

Well, if you use only one instance of the interpreter, don't throw it away,
and your script requires some code, that code will be compiled only once and
stay in mem AFAIK. (correct me someone if I'm wrong). So the overhead
shouldn't be too big.
So is it possible to precompile a ruby script (I don't want to have an ..exe
I want to have something like a precompiled .jar oder .class from java)?
If this isn't possible the question is if ruby isn't too slow for my usage
because I plan to use the scripting language very frequently within the
program.

Only testing and measuring can answer this question. It depends on the
usage of the language and the context (i.e. your server).
Are there any performance benchmarks available?

I guess there are. The question is, whether general purpose benchmarks will
help you. When it comes to performance, measurements have the final say.

Kind regards

robert
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top