This is why Ruby 1.8.6 can never be made to run anywhere near as fast as Python 2.5.1

R

Ruby Maniac

I welcome any corrections anyone might be able to make since I am new
to Ruby with less than 3 months experience under my belt.

Ruby 1.8.6 is an interpreted langauge that does not have a byte-code
driven VM at this time.

Python 2.5.1 is an interpreted language that does have a byte-code
driven VM.

I have been able to make Ruby code run 5% faster or more simply by
removing nothing but comments - the more comments I remove the faster
the code runs up to no more than 6% or 7%.

Ruby syntax seems to favor the notion that fewer characters is better
than more characters. Lexically interpreted langauges would want this
to be the case since it takes more effort to lex more characters.

Python runtimes are not affected by the number of characters one uses
such as extra whitespace or comments - removing comments does not make
Python code run faster simply because the comments have been removed.

Python has a very powerful JIT (Just In Time compiler) known as Psyco
with which certain Python expressions such as LC (List Comprehensions)
and others can be made to run 20x to 100x faster at runtime.

Recently as a test I wrote a rather simple Python program that
processed all characters of a 20 MB file by setting the MSB to 1. The
original Python code I began with executed in 65 seconds before I
began to optimize the code. After the code was fully optimized it ran
in just under 3 secs. After Psyco was used the runtime for the same
problem was less than 1 second.

The Ruby code I wrote before any optimizations were applied ran in
about 65 seconds or no faster than Python with no optimizations. The
most optimized Ruby code I could find for this problem was able to
execute in just under 22 seconds using techniques that were not
necessary when optimizing the Python code.

Given the best Ruby is capable of doing versus the best Python is
capable of doing Ruby ends up being more than 20x slower than Python
and I think I know why.

It is just not possible to make Ruby 1.8.6 execute any faster than the
Ruby interpreter is capable of executing the code due to the lack of a
byte-code driven VM. Maybe someday YARV will make Ruby code run 2x
faster than Ruby 1.8.6 but that day has not arrived yet and may never
arrived.

Even if YARV proves to be 2x faster than Ruby 1.8.6 the resulting Ruby
code will still be 10x slower than the fastest Python code.

The only way YARV will get faster than Python is whenever someone
codes a JIT compiler for YARV that provides the same performance boost
to Ruby that Psyco provides to Python. As far as I can tell nobody is
working on any such JIT for YARV and since YARV has been under
development for at least the last 14 to 18 months one can only surmise
a JIT for YARV would take a significant amount of time to produce and
release to the Ruby community.

The bottom line is that Python can be made to run as fast as machine
code but Ruby cannot.

I know some people want to try to use Ruby for every single problem
they are faced with but doing so would be less than wise since there
are no tools that work for all problems.

Some problems lend themselves nicely to Ruby such as Open Source
products where giving away the source code is not a business
problem.

Python is useful for problems that require fast runtimes such as 3D
modelling or video game programming.

Ruby would not be fast enough for the kinds of problems where people
are using Python.

I have not been able to find any references to Ruby being used for 3D
realtime video game programming but I have been able to find many
references to Python being used for 3D realtime video game
programming.

I don't expect those who read this to applaud my efforts to discuss
this in this forum however I feel we need to discuss this so that some
may choose to take actions to make Ruby run faster at runtime just as
work was done to make Python run faster at runtime.

Believe it or not I actually like Ruby 1.8.6 but I would hesitate to
try to use Ruby for situations where runtime performance was an issue
or whenever I did not want to release the source code.

When I write code I want to know I am using tools that give me the
best performance for the effort that I can possibly get as opposed to
tools that guarantee no matter how hard I work performance will always
be lacking.

The same comments could be made about Rails. Rails emits SQL
statements that have a lot of "*" characters. Those of us who have
been coding SQL long enough know the use of "*" characters makes SQL
statements run slower than when fully qualified column names are used
rather than the "*". I coded a simple benchmark that demonstrated
this very clearly; whenever "*" was used rather than a list of column
names the resulting SQL statements ran 10% to 880% slower than when
the "*" was replaced with a list of column names even when the list of
column names was quite long.

Oddly enough I quite easily found more powerful Database Frameworks
for Python that did not emit SQL code that used "*" characters and I
was even able to find some interfaces for those SQL Frameworks that
would allow seasonsed Rails developers use Rails statements when
describing their database relationships.

I know of some Ruby developers who rejected the idea that the use of
"*" in SQL statements would be slower than long lists of column
names. From the perspective of a Ruby on Rails developer who has not
coded anything but Rails or Ruby it might seem logical that fewer
characters is better than more characters and so the use of "*" in SQL
statements must be optimial because this is how Ruby works, right ?!?
Wrong !

Even when some RoR developers are faced with benchmarks that
demonstrate the use of "*" in SQL statements can be 10% to 880% slower
than not using "*" characters they still chose to reject the
benchmarks and deny the benefits of not using Rails because Rails is
not able to automatically replace "*" with lists of column names,
apparently.

When people choose to make their choices of languages a religious
issue they can become rather short-sighted in how they choose to
resolve programming problems.

I prefer to be agnostic about programming languages. I choose those
that perform the best and I ignore the rest.

Ruby is a cute language that may someday become useful but this won't
happen unless the Ruby community becomes interested in making Ruby
perform better at runtime. In the meantime, I will use Ruby only when
I must as for the rest I will most-likely use Python unless the
problem suggests another language may be more useful.
 
M

M. Edward (Ed) Borasky

Ruby said:
Even if YARV proves to be 2x faster than Ruby 1.8.6 the resulting Ruby
code will still be 10x slower than the fastest Python code.

Care to bet on that? I just benchmarked "YARV" at something like 5X Ruby
1.8.6, with some bursts as high as 72X!
 
W

Wilson Bilkovich

I welcome any corrections anyone might be able to make since I am new
to Ruby with less than 3 months experience under my belt.
I'm not going to address any of your Rails comments, because they have
nothing to do with Ruby. Rails is just a library.

Python is not faster than Ruby due to language design, but because
skilled people got together and made it faster. Nothing is stopping
people from doing the same for Ruby.

Some corrections:
1. YARV is 'out', in the form of Ruby 1.9. A stable release is coming
in a matter of months.

2. JIT is nice, but it is not a panacea. C and C++ are plenty fast,
and use AOT compilation, not JIT. Java has shown that a combination of
AOT and JIT can yield impressive performance, but Psyco is merely one
approach out of many.

3. YARV has some (unfinished) competition with significantly varying approaches:
* JRuby: The trunk version offers compilation as well as
interpretation. At some point it will almost certainly support fancy
JIT tricks, given its architecture. http://jruby.codehaus.org/
* Rubinius: Currently supports 'only' AOT compilation to bytecode.
When it is done, we will be doing much more sophisticated things, a la
Pepsi/Coke/J3. http://rubini.us/
* IronRuby: I don't know enough about their architecture to say, but
they will probably bring some impressive performance to the table as
well.

Please don't judge Ruby the language by looking at the current 1.8
implementation. They are not the same thing, and the limitations of
1.8 are not necessarily invariant constraints.

On the other hand, I'm probably wasting my time with this reply.
Calling Ruby a "cute" language means you are almost certainly a troll.
Please forgive me if I am wrong about this.
 
B

Bill Kelly

From: "Ruby Maniac said:
I prefer to be agnostic about programming languages. I choose those
that perform the best and I ignore the rest.

That's agnosticism? Sounds like a sermon from the Church
of Premature Optimization. <grin>

Kidding aside, that's great that you know what you want from
a programming language.

Many of us know what we want, too.

I accept that Ruby is slow to execute (although getting faster).
It's more important to me that Ruby is fun and productive to
program in, and that Ruby is merely _fast enough_ for the task
at hand.

I've dabbled in a number of languages, but I've written actual
production code in assembler, Forth, C, C++, Objective-C, Java,
Perl, Python, Ruby, and (kill me now) VB6.

If one took your "choose those that perform the best and ignore
the rest" razor literally, one would assume you would choose to
write only hand-tuned assembly.

Have you written much hand-tuned assembler lately? No? Neither
have I.

Fifteen to twenty years ago, it was still common for many video
games to be coded entirely in assembler. Myself, I preferred
to write as much as possible in C, and drop down to assembler
only when necessary.

Today, it's really the same equation. I write as much in Ruby
as possible, but drop down to C when needed.

Obviously, the faster Ruby gets, the better. But again, many
of us have been programming in Ruby for years, not because we
don't know half a dozen faster languages, but because we like
programming in Ruby, and find it fast enough for most of our
needs. And if some method needs to go way faster, there's
always C.


Regards,

Bill
 
P

Phrogz

Ruby is a cute language that may someday become useful but this won't
happen unless the Ruby community becomes interested in making Ruby
perform better at runtime.

To be clear, it may someday become useful *to you*; it's already
useful to me.
In the meantime, I will use Ruby only when
I must as for the rest I will most-likely use Python unless the
problem suggests another language may be more useful.

I'd be interested to know under what circumstance(s) you expect to be,
or already are, forced to use Ruby. (Developing RoR sites in a team
environment?)
 
M

Michael T. Richter

--=-DebiaOMQneJ/gXKDwVpv
Content-Type: multipart/alternative; boundary="=-lcrn6u/mZnKmchr/4d/p"


--=-lcrn6u/mZnKmchr/4d/p
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Can I ask why *ANYBODY* took a message by someone calling themselves
"Ruby Maniac" and using expressions like "cute language" as anything but
a troll? Anybody? Anybody? Bueller?

Don't dignify these kinds of things with responses, peeps.

--=20
Michael T. Richter <[email protected]> (GoogleTalk:
(e-mail address removed))
Never, ever, ever let systems-level engineers do human interaction
design unless they have displayed a proven secondary talent in that
area. Their opinion of what represents good human-computer interaction
tends to be a bit off-track. (Bruce Tognazzini)

--=-lcrn6u/mZnKmchr/4d/p
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; CHARSET=3DUTF-8">
<META NAME=3D"GENERATOR" CONTENT=3D"GtkHTML/3.12.1">
</HEAD>
<BODY>
Can I ask why *ANYBODY* took a message by someone calling themselves &quot;=
Ruby Maniac&quot; and using expressions like &quot;cute language&quot; as a=
nything but a troll?&nbsp; Anybody?&nbsp; Anybody?&nbsp; Bueller?<BR>
<BR>
Don't dignify these kinds of things with responses, peeps.<BR>
<BR>
<TABLE CELLSPACING=3D"0" CELLPADDING=3D"0" WIDTH=3D"100%">
<TR>
<TD>
-- <BR>
<B>Michael T. Richter</B> &lt;<A HREF=3D"mailto:[email protected]">ttmri=
(e-mail address removed)</A>&gt; (<B>GoogleTalk:</B> (e-mail address removed))<BR>
<I>Never, ever, ever let systems-level engineers do human interaction desig=
n unless they have displayed a proven secondary talent in that area. Their =
opinion of what represents good human-computer interaction tends to be a bi=
t off-track. (Bruce Tognazzini)</I>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>

--=-lcrn6u/mZnKmchr/4d/p--

--=-DebiaOMQneJ/gXKDwVpv
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQBG90czLqyWkKVQ54QRApJvAJ46LU5Wzbr17cqjA07AqxuldYqeFwCgsXQ0
tOYLjDBEzq4Mk4BWWTNS+Dw=
=hwAD
-----END PGP SIGNATURE-----

--=-DebiaOMQneJ/gXKDwVpv--
 
M

Mohit Sindhwani

John said:
Why do people troll?
What pleasure could it bring?

Fear, uncertainty and doubt - that's what drives people!

Cheers,
Mohit.
9/24/2007 | 1:25 PM.
 
M

M. Edward (Ed) Borasky

Michael said:
Can I ask why *ANYBODY* took a message by someone calling themselves
"Ruby Maniac" and using expressions like "cute language" as anything but
a troll? Anybody? Anybody? Bueller?

Don't dignify these kinds of things with responses, peeps.

Well ... yes ... I suppose if I hadn't just run the benchmarks and
posted the results, I wouldn't have responded. But I am so thrilled to
see that 5X number for "YARV". Is there anyone here who thinks they can
get a 5X boost for Python 2.5? Perl 5.8.8? PHP 5?
 
M

Michael T. Richter

--=-+b2s378W/uy25t4HvOh+
Content-Type: multipart/alternative; boundary="=-N3spvnf/hcOZCE+B+suV"


--=-N3spvnf/hcOZCE+B+suV
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Why do people troll?
What pleasure could it bring?



Control. People whose daily lives have little in the way of things they
have control over like the illusion that upsetting other people and
having them react is like controlling their own lives.

--=20
Michael T. Richter <[email protected]> (GoogleTalk:
(e-mail address removed))
We should sell bloat credits, the way the government sells pollution
credits. Everybody's assigned a certain amount of bloat, and if they go
over, they have to purchase bloat credits from some other group that's
been more careful. (Bent Hagemark)

--=-N3spvnf/hcOZCE+B+suV
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; CHARSET=3DUTF-8">
<META NAME=3D"GENERATOR" CONTENT=3D"GtkHTML/3.12.1">
</HEAD>
<BODY>
On Mon, 2007-24-09 at 14:05 +0900, John Joyce wrote:
<BLOCKQUOTE TYPE=3DCITE>
<PRE>
<FONT COLOR=3D"#000000">Why do people troll?</FONT>
<FONT COLOR=3D"#000000">What pleasure could it bring?</FONT>
</PRE>
</BLOCKQUOTE>
<PRE>

</PRE>
Control.&nbsp; People whose daily lives have little in the way of things th=
ey have control over like the illusion that upsetting other people and havi=
ng them react is like controlling their own lives.<BR>
<BR>
<TABLE CELLSPACING=3D"0" CELLPADDING=3D"0" WIDTH=3D"100%">
<TR>
<TD>
-- <BR>
<B>Michael T. Richter</B> &lt;<A HREF=3D"mailto:[email protected]">ttmri=
(e-mail address removed)</A>&gt; (<B>GoogleTalk:</B> (e-mail address removed))<BR>
<I>We should sell bloat credits, the way the government sells pollution cre=
dits. Everybody's assigned a certain amount of bloat, and if they go over, =
they have to purchase bloat credits from some other group that's been more =
careful. (Bent Hagemark)</I>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>

--=-N3spvnf/hcOZCE+B+suV--

--=-+b2s378W/uy25t4HvOh+
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQBG906wLqyWkKVQ54QRAnknAKCacRmLkJJDcxi4Ewgey6WOsxDv7ACgwvyK
+G3D9orfJYSZU5W5P3tnfD4=
=Tllk
-----END PGP SIGNATURE-----

--=-+b2s378W/uy25t4HvOh+--
 
M

Michael T. Richter

--=-//p4wBwtwJwMuN5+jSlv
Content-Type: multipart/alternative; boundary="=-3JEfb81oFRPnf4pLNFbH"


--=-3JEfb81oFRPnf4pLNFbH
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Well ... yes ... I suppose if I hadn't just run the benchmarks and
posted the results, I wouldn't have responded. But I am so thrilled to
see that 5X number for "YARV". Is there anyone here who thinks they can
get a 5X boost for Python 2.5? Perl 5.8.8? PHP 5?



You're still playing into their game. You're reacting to the troll's
input. If you want to share the good news about YARV performance, start
your own breathless thread. Don't respond to a troll. ESPECIALLY don't
quote the troll and do a point-by-point counter. That's exactly what
they're looking for.

Let me give you a little secret: the troll knows all your countering
arguments. In another forum, under a different name, the troll is using
those very same arguments to tweak the noses of other people and make
them "dance to his strings". The only winning move, as the old movie
goes, is not to play the game.

--=20
Michael T. Richter <[email protected]> (GoogleTalk:
(e-mail address removed))
When debugging, novices insert corrective code; experts remove defective
code. (Richard Pattis)

--=-3JEfb81oFRPnf4pLNFbH
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; CHARSET=3DUTF-8">
<META NAME=3D"GENERATOR" CONTENT=3D"GtkHTML/3.12.1">
</HEAD>
<BODY>
On Mon, 2007-24-09 at 14:26 +0900, M. Edward (Ed) Borasky wrote:
<BLOCKQUOTE TYPE=3DCITE>
<PRE>
<FONT COLOR=3D"#000000">&gt; Can I ask why *ANYBODY* took a message by some=
one calling themselves</FONT>
<FONT COLOR=3D"#000000">&gt; &quot;Ruby Maniac&quot; and using expressions =
like &quot;cute language&quot; as anything but</FONT>
<FONT COLOR=3D"#000000">&gt; a troll? Anybody? Anybody? Bueller?</FONT>
</PRE>
</BLOCKQUOTE>
<BR>
<BLOCKQUOTE TYPE=3DCITE>
<PRE>
<FONT COLOR=3D"#000000">&gt; Don't dignify these kinds of things with respo=
nses, peeps.</FONT>
</PRE>
</BLOCKQUOTE>
<BR>
<BLOCKQUOTE TYPE=3DCITE>
<PRE>
<FONT COLOR=3D"#000000">Well ... yes ... I suppose if I hadn't just run the=
benchmarks and</FONT>
<FONT COLOR=3D"#000000">posted the results, I wouldn't have responded. But =
I am so thrilled to</FONT>
<FONT COLOR=3D"#000000">see that 5X number for &quot;YARV&quot;. Is there a=
nyone here who thinks they can</FONT>
<FONT COLOR=3D"#000000">get a 5X boost for Python 2.5? Perl 5.8.8? PHP 5?</=
FONT>
</PRE>
</BLOCKQUOTE>
<PRE>

</PRE>
You're still playing into their game.&nbsp; You're reacting to the troll's =
input.&nbsp; If you want to share the good news about YARV performance, sta=
rt your own breathless thread.&nbsp; Don't respond to a troll.&nbsp; ESPECI=
ALLY don't quote the troll and do a point-by-point counter.&nbsp; That's ex=
actly what they're looking for.<BR>
<BR>
Let me give you a little secret: the troll knows all your countering argume=
nts.&nbsp; In another forum, under a different name, the troll is using tho=
se very same arguments to tweak the noses of other people and make them &qu=
ot;dance to his strings&quot;.&nbsp; The only winning move, as the old movi=
e goes, is not to play the game.<BR>
<BR>
<TABLE CELLSPACING=3D"0" CELLPADDING=3D"0" WIDTH=3D"100%">
<TR>
<TD>
-- <BR>
<B>Michael T. Richter</B> &lt;<A HREF=3D"mailto:[email protected]">ttmri=
(e-mail address removed)</A>&gt; (<B>GoogleTalk:</B> (e-mail address removed))<BR>
<I>When debugging, novices insert corrective code; experts remove defective=
code. (Richard Pattis)</I>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>

--=-3JEfb81oFRPnf4pLNFbH--

--=-//p4wBwtwJwMuN5+jSlv
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQBG90/TLqyWkKVQ54QRAg2TAKCfhX7BX4DPFgPWPNPVsMUNOKx5zACgjmmW
jBzSPNErkmU50ElbYzoLtfc=
=rrer
-----END PGP SIGNATURE-----

--=-//p4wBwtwJwMuN5+jSlv--
 
E

Eric Hodel

I welcome any corrections anyone might be able to make since I am new
to Ruby with less than 3 months experience under my belt.

Ruby 1.8.6 is an interpreted langauge that does not have a byte-code
driven VM at this time.

Python 2.5.1 is an interpreted language that does have a byte-code
driven VM.

I have been able to make Ruby code run 5% faster or more simply by
removing nothing but comments - the more comments I remove the faster
the code runs up to no more than 6% or 7%.

Then you aren't benchmarking with enough iterations. Comments are
skipped and thrown away. They aren't part of the AST.
[...] Lexically interpreted langauges would want this
to be the case since it takes more effort to lex more characters.

And you only lex a file once in Ruby. As a proportion of runtime,
turning a source file into an AST is small.
Python runtimes are not affected by the number of characters one uses
such as extra whitespace or comments

Nor are Ruby's.
- removing comments does not make Python code run faster simply
because the comments have been removed.

$ echo '5 + 6 # and a comment, which is not in the AST' |
parse_tree_show -f
s:)call, s:)lit, 5), :+, s:)array, s:)lit, 6)))

No, really, they aren't there.

I stopped reading your email here. I scanned the rest and you didn't
provide any code to back up your assertion that removing comments
improves ruby performance. I'd be happy to look at it if you can
post it.
 
A

Alex Young

Michael T. Richter wrote:
Let me give you a little secret: the troll knows all your countering
arguments. In another forum, under a different name, the troll is using
those very same arguments to tweak the noses of other people and make
them "dance to his strings". The only winning move, as the old movie
goes, is not to play the game.

Normally I'd agree with you, but this post does seem to be the product
of some honest investigation:
http://objectmix.com/python/208141-...n-code-run-faster-using-only-python-code.html
 
W

William James

Ruby is a cute language that may someday become useful

Someday when you are a more experienced programmer, you
may realize that doing bitwise operations on each byte
of a 2-megabyte file is not an appropriate task for a
"scripting language". That calls for a lower-level language.

Ruby is excellent for processing text a word, a line, or a
paragraph at a time. I do almost all of my programming at
home in Ruby. It doesn't matter to me whether the program
runs in 0.05 sec. or 0.2 sec. I can't use Ruby quite as much
as I would like at work, since I have to control the mainframe
terminal emulator with a dialect of Basic that's similar to FreeBasic
and QuickBasic.
 
P

Paul Brannan

You're still playing into their game. You're reacting to the troll's
input. If you want to share the good news about YARV performance,
start your own breathless thread. Don't respond to a troll.
ESPECIALLY don't quote the troll and do a point-by-point counter.
That's exactly what they're looking for.
Let me give you a little secret: the troll knows all your countering
arguments. In another forum, under a different name, the troll is
using those very same arguments to tweak the noses of other people and
make them "dance to his strings". The only winning move, as the old
movie goes, is not to play the game.

You sure do seem to know a lot about trolls. :)

Seriously, though, any move that falls outside the troll's script is a
valid move. Not playing at all works, but rarely, since not everyone
follows that advice.

I've found that trolling the troll also works, that is, making plausible
but ridicuous arguments in order to frustrate the troll. This is a
difficult maneuver in a public forum like this one.

Responding in kindness rather than argumentatively works as well, if the
troll's intentions were to start an argument.

People with crediblity should almost never respond to a troll, because
their response gives the troll credibility, so if you are going to try
to beat the troll at his own game, get an alias, or limit your responses
to those which reduce the troll's credibility while keeping your own
intact.

Calling the troll a troll is dangerous, since it's essentially an ad
hominem attack that can reduce your own credibility over time.

The goal in any response to a thread started by the troll should be to
prevent thread explosion. If the thread has already reached critical
mass, responding to the thread further postpones its death.

Trolls can also show up in real life situations. These trolls are best
handled by turning the forum into a debate so, keeping in mind that the
goal of a debate is to convince the audience rather than the other
person.

Paul
 
M

M. Edward (Ed) Borasky

William said:
Someday when you are a more experienced programmer, you
may realize that doing bitwise operations on each byte
of a 2-megabyte file is not an appropriate task for a
"scripting language". That calls for a lower-level language.

Well ... if the bitwise operations are built into the "scripting
language", why *shouldn't* they be used? It's not like you have to make
them up by converting the bytes to floating point values, converting
them to an array of floating point ones and zeroes and doing ANDs and
ORs on them with floating point equality tests in IF statements!
 
C

Chad Perrin

Don't forget a rutheless dedication to the Pope!

There's nothing like a Pope in the eye with a sharp stick to make a troll
roll out of bed in the morning and say "I have to go rile up one of the
friendliest programmer communities on the Internet!"
 
M

M. Edward (Ed) Borasky

Chad said:
There's nothing like a Pope in the eye with a sharp stick to make a troll
roll out of bed in the morning and say "I have to go rile up one of the
friendliest programmer communities on the Internet!"
And when did Ruth leave the community? Please don't tell me Grace left too!
 
C

Chad Perrin

Some others have addressed many of your points admirably. For the most
part, I didn't really see much point in responding to what you had to
say. On the other hand, a couple of items just bothered me so much I
can't really help myself.


Given the best Ruby is capable of doing versus the best Python is
capable of doing Ruby ends up being more than 20x slower than Python
and I think I know why.

It is just not possible to make Ruby 1.8.6 execute any faster than the
Ruby interpreter is capable of executing the code due to the lack of a
byte-code driven VM. Maybe someday YARV will make Ruby code run 2x
faster than Ruby 1.8.6 but that day has not arrived yet and may never
arrived.

Even if YARV proves to be 2x faster than Ruby 1.8.6 the resulting Ruby
code will still be 10x slower than the fastest Python code.

I guess you haven't been watching the recent thread that revealed how
much of a performance boost you can get moving from 1.8.6 to 1.9 (among
other means of reducing execution time).

The bottom line is that Python can be made to run as fast as machine
code but Ruby cannot.

Sure it can. A language does not, in and of itself, dictate the form of
the implementation. There could conceivably one day be an optimizing
binary compiler implementated for Ruby while Python might not progress
much beyond where it is now (or vice-versa). You'd suddenly find that
Python does *not* actually execute as fast as "machine code" (meaning
binary executables, as opposed to VM bytecode). The fact that Ruby uses
an interpreter right now doesn't mean that things won't change in the
future.

On the other hand, for many types of development projects, programmer
time is a lot more valuable than CPU time. In such circumstances, Ruby
is one of the best choices around for development language.

Python is useful for problems that require fast runtimes such as 3D
modelling or video game programming.

Ruby would not be fast enough for the kinds of problems where people
are using Python.

Not so much -- not much more so than Ruby, at any rate. People write
"serious" games in C++ for the most part, these days. Python doesn't
even begin to compare in that realm. In cases where speed matters enough
that Ruby isn't even an option, people are generally avoiding Python,
too. Only in cases where people like to *think* speed matters, but it
doesn't really, do people choose something like Python over something
like Ruby on performance grounds.

When I write code I want to know I am using tools that give me the
best performance for the effort that I can possibly get as opposed to
tools that guarantee no matter how hard I work performance will always
be lacking.

You might want to move from Python to Perl, then.

Maybe you should then move from Perl to C++.

Of course, then perhaps you should consider moving from C++ to Objective
Caml.

At that point, you might consider moving on to C.

Once you get to C, you might consider moving on up to assembly language.

While you're playing around in assembly language, you could even choose
your architecture (and thus your specific flavor of assembly language)
based on the CPU instruction set.

Let me know when you get to the point that you're writing the equivalent
of shell scripts in assembly on the architecture with the most efficient
CPU instruction set. At that point, I'll believe what you say about
putting all your eggs in the performance basket.

When people choose to make their choices of languages a religious
issue they can become rather short-sighted in how they choose to
resolve programming problems.

Yes, you can certainly do that when you religiously attach yourself to
single-issue arguments for one language over another.

I prefer to be agnostic about programming languages. I choose those
that perform the best and I ignore the rest.

These are contradictory statements.

I'm sure pretty much everyone here can see the faults in your arguments
for what they are. As such, you're not really doing a lot of damage to
the reputation of Ruby -- and any attemps to chalk all this up to an
attempt to get Ruby core developers to change their focus to performance
are self-evident nonsense, considering I'm sure they know far better than
you (and me) the key issues they face. On the other hand, you're
positioning yourself as a representative of Python on a Ruby list.

I'm not a fan of Python. I don't personally like it. On the other hand,
I can step back and (somewhat) objectively recognize Python's advantages
as a language. It really is a great language in purely technical terms,
as are Ruby, Perl, Objective Caml, and a host of other languages,
regardless of whether it's a great language *for me*. If you're doing
any damage to any language community, however, it's to the Python
community, by giving people one more data point in their statistical
comparisons of the attitudes of Pythonistas. That's not very fair to the
Python community.

You'd be doing us a favor if you stopped contributing to the Noise:Signal
ratio, but you'd be doing Python's community a bigger favor by ceasing to
pretend to advocate for Python.

I really only comment on this in hopes that it may forestall any
knee-jerk reactions to you that may lead to others judging Python more
harshly because of this one self-appointed representative. In other
words, I may be addressing you, but you're not my audience.
 

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

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,001
Latest member
Kendra00E1

Latest Threads

Top