WHY is python slow?
gs at styrax.com
Thu Jun 7 18:03:54 CEST 2001
if you go to:
and change the weightings to 0 for CPU and memory usage respectively
(CPUs and memory are way cheaper than programmers after all!), and 10
for lines of code, ruby and python are the clear winners.
now, if we accept the postulate that premature programme optimisation
is an evil and that python has been around much longer than ruby, has
much better documentation and that in Bruce Eckel's words:
"...I usually find that this question [Do you have any opinions about
the Ruby language, especially compared to Python?]is asked by someone
who is considering learning to program, and was snagged by the fact
that Ruby is new, and perhaps thinks that it's going to be the next
great thing like Java. From everything I can see, it's not. For some
reason, the creator of the language saw Python and decided to do a
clone, and people who had never used Python thought it was a good
idea. Harsh, maybe, but that's my impression: if you've used Python
at all, you wouldn't give Ruby a second glance. "
then python is the clear winner!
On 7 Jun 2001, at 12:34, Mitchell Morris wrote:
From: mitchell.morris at cingular.com (Mitchell Morris)
Subject: Re: WHY is python slow?
To: python-list at python.org
Date sent: 7 Jun 2001 12:34:09 GMT
> Steven Haryanto <steven at haryan.to> wrote in
> <mailman.991900751.7603.python- list at python.org>:
> > Although it is generally accepted that Python is slower than
> > Java/Perl/Ruby, a layman like me would be curious to know why
> > exactly this is so. In other words, why is the implementation
> > of a language like Ruby (which is on par with Python in terms
> > of 'everything is an object', strong reflection, dynamic
> > nature).
> > My first guess would be the ubiquitous use of dictionaries?
> > Steve
> > http://stevne.haryan.to/
> Well, perhaps your population sample isn't actually representative. I,
> for one, don't believe that your speed ordering is accurate, and I
> would further postulate that few other people on this newsgroup would
> agree with you.
> My second observation is that constructing a group of languages that
> includes Java, Perl, and Ruby as members but doesn't include Python
> must be using a very fine discriminant indeed <wink>.
> As a single point of data, may I present the language-specific pages
> from Bagley's "Computer Language Shootout"
> <URL:http://www.bagley.org/~doug/shootout/>. Each presents the
> finishing place for that language on each specific test. In addition,
> the average finishing place is calculated through an unspecified
> method (I'm assuming it's the arithmetic mean, but I'm not sure) in
> three categories: CPU usage, memory usage, and lines of code.
> CPU: 14, Memory: 17, LOC: 7
> CPU: 17, Memory: 12, LOC: 7
> CPU: 18, Memory: 14, LOC: 5
> CPU: 12, Memory: 20, LOC: 15
> CPU: 19, Memory: 12, LOC: 12
> OCaml: [my new favorite toy -- ed.]
> CPU: 3, Memory: 5, LOC: 10
> Under this ranking, Java is barely faster than Perl which is even more
> barely faster than Python which just as barely faster than Ruby which
> is (once again) only barely faster than Tcl. Mr.Bagley neglected to
> provide summary statistics for inter-language comparisons on these
> pages, so I have to provide my own:
> Language Mean Std.Dev
> -------- ---- -------
> Perl 13.6 6.2
> Python 16.6 3.8
> Ruby 18.0 4.6
> Java 11.5 4.2
> Tcl 20.8 4.0
> (Warning: undocumented math and unwarranted jumping-to-conclusions
> Notice the large standard deviation for Perl's results, especially
> compared to the standard deviation of the other datasets. This
> suggests that there are some outliers in the Perl dataset which are
> skewing the mean, and that generally the other languages perform more
> consistently over these tests. In addition, the mean/std.dev
> comparisons suggest that we can't yet conclude that Perl actually
> finshes ahead of either Python or Ruby in the general case, but they
> do suggest that we can tentatively say that Perl finshes ahead of Tcl
> for these tests. (Isn't it wonderful how statistics lets you be so
> certain about making such sweeping statements? <0.1 wink>)
> I have my own reservations about the applicability of this shootout to
> anything but Usenet arguments, but since that *IS* what we're having
> I'm delighted to wield it <wink>.
> if-you'd-only-claimed-Jython-was-slow-ly y'rs,
> P.S. Keep in mind that all this is based on the finishing placements
> in the elements of the test suite, not the raw performance numbers
> which I didn't feel like extracting from all over the entire website.
> Jiggery-pokery, indeed! --
Garry Steedman mailto:gs at styrax.com
Styrax Associates http://www.styrax.com/
"The Good Man has no shape."
More information about the Python-list