Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > python/ruby benchmark.

Reply
Thread Tools

python/ruby benchmark.

 
 
\
Guest
Posts: n/a
 
      06-09-2005
I took a look at
http://shootout.alioth.debian.org/be...g=3Druby&lang=
2=3Dpython&sort=3Dfullcpu
and found the tests on ruby disapointing .
So what I'm asking for is a link to some ruby-specific optimisation tips.

--=20
Regards, Groleo!

# touch universe
# chmod +x universe
# ./universe


 
Reply With Quote
 
 
 
 
gabriele renzi
Guest
Posts: n/a
 
      06-09-2005
"</script> ha scritto:
> I took a look at
> http://shootout.alioth.debian.org/be...n&sort=fullcpu
> and found the tests on ruby disapointing .
> So what I'm asking for is a link to some ruby-specific optimisation tips.


a simple thing: do the most normal thing instead of writing code in ruby
that is innatural, i.e. instead of rewritine an heapsort by hand, use
the builtin sort/sort!/sort_by routines. Instead of writing a random
function by hand, use the builtin rand().

If you really feel ruby (or python) is slow you can act later optimizing
it, not doing it before you ever need to be faster. "premature
optimization is the root of all evil", people say.
 
Reply With Quote
 
 
 
 
Glenn Parker
Guest
Posts: n/a
 
      06-09-2005
> So what I'm asking for is a link to some ruby-specific optimisation tips.

Avoid creating new objects, e.g. re-use strings and arrays, or modify
them in place when possible, especially large ones.

Use built-in iterators as much as possible.

Pray for YARV!

--
Glenn Parker | glenn.parker-AT-comcast.net | <http://www.tetrafoil.com/>


 
Reply With Quote
 
Vincent Foley
Guest
Posts: n/a
 
      06-09-2005
As Gabriele mentionned, they implement a lot of stuff that is done in C
in Ruby. Also, the tests must use the exact same algorithm, so this
disadvantages Ruby is some situations. I say the test should compare
same algorithms, but also the one best suited to the language.

 
Reply With Quote
 
Lothar Scholz
Guest
Posts: n/a
 
      06-09-2005
Hello gabriele,

gr> "</script> ha scritto:
>> I took a look at
>> http://shootout.alioth.debian.org/be...n&sort=fullcpu
>> and found the tests on ruby disapointing .
>> So what I'm asking for is a link to some ruby-specific optimisation tips.


gr> a simple thing: do the most normal thing instead of writing code in ruby
gr> that is innatural, i.e. instead of rewritine an heapsort by hand, use
gr> the builtin sort/sort!/sort_by routines. Instead of writing a random
gr> function by hand, use the builtin rand().

Sorry you don't understand this benchmark. It is there to do this
algorithms to compare the basic data operations.

The benchmark is not useable to compare compiled languages with
interpretered, but comparing python with ruby is a valid comparision.

And that ruby is so worse then python is a real problem. If you still
try to deny this, then you have a real mental problem.

If ruby is 9 times slower then python in for example function calling intensive
code that means that ruby will slow down your development time a lot
as it forces you to use optimized code or even C code much more often
then python.


--
Best regards, emailto: scholz at scriptolutions dot com
Lothar Scholz http://www.ruby-ide.com
CTO Scriptolutions Ruby, PHP, Python IDE 's




 
Reply With Quote
 
Kent Sibilev
Guest
Posts: n/a
 
      06-09-2005
Java is an order of magnitude faster than Ruby. The development of a
web app using Rails is an order of magnitude faster than the
development of a similar web app using Struts/Hibernate frameworks.
There are other factors that can slow down your development time
besides the speed of your language of choice.

Cheers,
Kent
Just another guy with huge mental problems.

On 6/9/05, Lothar Scholz <> wrote:
> Hello gabriele,
>=20
> gr> "</script> ha scritto:
> >> I took a look at
> >> http://shootout.alioth.debian.org/be...l&lang=3Druby=

&lang2=3Dpython&sort=3Dfullcpu
> >> and found the tests on ruby disapointing .
> >> So what I'm asking for is a link to some ruby-specific optimisation ti=

ps.
>=20
> gr> a simple thing: do the most normal thing instead of writing code in r=

uby
> gr> that is innatural, i.e. instead of rewritine an heapsort by hand, use
> gr> the builtin sort/sort!/sort_by routines. Instead of writing a random
> gr> function by hand, use the builtin rand().
>=20
> Sorry you don't understand this benchmark. It is there to do this
> algorithms to compare the basic data operations.
>=20
> The benchmark is not useable to compare compiled languages with
> interpretered, but comparing python with ruby is a valid comparision.
>=20
> And that ruby is so worse then python is a real problem. If you still
> try to deny this, then you have a real mental problem.
>=20
> If ruby is 9 times slower then python in for example function calling int=

ensive
> code that means that ruby will slow down your development time a lot
> as it forces you to use optimized code or even C code much more often
> then python.
>=20
>=20
> --
> Best regards, emailto: scholz at scriptolutions d=

ot com
> Lothar Scholz http://www.ruby-ide.com
> CTO Scriptolutions Ruby, PHP, Python IDE 's
>=20
>=20
>=20
>



 
Reply With Quote
 
Dibya Prakash
Guest
Posts: n/a
 
      06-09-2005
Hi,
I definitely agree.Only feature of a particular programming language
cannot determine the speed of software.Other factors are also
crucially important.
I didnot know about YARV,but gr8 that I came to know it thru u
people.I'll surely check it out.

Bye
Dibya Prakash
Happy coding

On 6/9/05, Kent Sibilev <> wrote:
> Java is an order of magnitude faster than Ruby. The development of a
> web app using Rails is an order of magnitude faster than the
> development of a similar web app using Struts/Hibernate frameworks.
> There are other factors that can slow down your development time
> besides the speed of your language of choice.
>=20
> Cheers,
> Kent
> Just another guy with huge mental problems.
>=20
> On 6/9/05, Lothar Scholz <> wrote:
> > Hello gabriele,
> >
> > gr> "</script> ha scritto:
> > >> I took a look at
> > >> http://shootout.alioth.debian.org/be...all&lang=3Dru=

by&lang2=3Dpython&sort=3Dfullcpu
> > >> and found the tests on ruby disapointing .
> > >> So what I'm asking for is a link to some ruby-specific optimisation =

tips.
> >
> > gr> a simple thing: do the most normal thing instead of writing code in=

ruby
> > gr> that is innatural, i.e. instead of rewritine an heapsort by hand, u=

se
> > gr> the builtin sort/sort!/sort_by routines. Instead of writing a rando=

m
> > gr> function by hand, use the builtin rand().
> >
> > Sorry you don't understand this benchmark. It is there to do this
> > algorithms to compare the basic data operations.
> >
> > The benchmark is not useable to compare compiled languages with
> > interpretered, but comparing python with ruby is a valid comparision.
> >
> > And that ruby is so worse then python is a real problem. If you still
> > try to deny this, then you have a real mental problem.
> >
> > If ruby is 9 times slower then python in for example function calling i=

ntensive
> > code that means that ruby will slow down your development time a lot
> > as it forces you to use optimized code or even C code much more often
> > then python.
> >
> >
> > --
> > Best regards, emailto: scholz at scriptolutions=

dot com
> > Lothar Scholz http://www.ruby-ide.com
> > CTO Scriptolutions Ruby, PHP, Python IDE 's
> >
> >
> >
> >

>=20
>



 
Reply With Quote
 
Lothar Scholz
Guest
Posts: n/a
 
      06-09-2005
Hello Kent,

KS> Java is an order of magnitude faster than Ruby. The development of a
KS> web app using Rails is an order of magnitude faster than the
KS> development of a similar web app using Struts/Hibernate frameworks.
KS> There are other factors that can slow down your development time
KS> besides the speed of your language of choice.

If i can't use the language because it is to slow to solve the problem
then the development time doesn't matter. There are just too many
problem domains left where you can't ignore it.

But we all hope and pray for YARV.


--
Best regards, emailto: scholz at scriptolutions dot com
Lothar Scholz http://www.ruby-ide.com
CTO Scriptolutions Ruby, PHP, Python IDE 's




 
Reply With Quote
 
gabriele renzi
Guest
Posts: n/a
 
      06-09-2005
Lothar Scholz ha scritto:
> Hello gabriele,
>
> gr> "</script> ha scritto:
>
>>>I took a look at
>>>http://shootout.alioth.debian.org/be...n&sort=fullcpu
>>>and found the tests on ruby disapointing .
>>>So what I'm asking for is a link to some ruby-specific optimisation tips.

>
>
> gr> a simple thing: do the most normal thing instead of writing code in ruby
> gr> that is innatural, i.e. instead of rewritine an heapsort by hand, use
> gr> the builtin sort/sort!/sort_by routines. Instead of writing a random
> gr> function by hand, use the builtin rand().
>
> Sorry you don't understand this benchmark. It is there to do this
> algorithms to compare the basic data operations.


I understand the benchmark.
I'm just saying that it shows "you should not implement X in ruby" not
that "X takes a lot of time in ruby" since you may not need to implement
X (i.e. because it is already there or because you would not actually
ever need a recursive floating point function).

> The benchmark is not useable to compare compiled languages with
> interpretered, but comparing python with ruby is a valid comparision.
>
> And that ruby is so worse then python is a real problem. If you still
> try to deny this, then you have a real mental problem.


I don't think I did

> If ruby is 9 times slower then python in for example function calling intensive
> code that means that ruby will slow down your development time a lot
> as it forces you to use optimized code or even C code much more often
> then python.


I agree, It would be nice if ruby was faster. Luckily,
people are working on this.
 
Reply With Quote
 
Jim Freeze
Guest
Posts: n/a
 
      06-10-2005
* gabriele renzi <> [2005-06-10 09:35:28 +0900]:

> I agree, It would be nice if ruby was faster. Luckily,
> people are working on this.


Don't go away thinking that X is faster than Ruby. Do
your own tests. We tested Perl against Ruby in a real
world problem (netlist parsing) and Ruby was faster
than Perl by 30%. When we did a C implementation
(which could now be done automatically with optimize)
it was 100% faster (ie, took half the time.)

These statements that X language is faster than
Ruby is like saying that Einstein is smarter than
Mozart. In what?

--
Jim Freeze
Theory and practice are the same, in theory. -- Ryan Davis


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57