Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > how fast is Python?

Reply
Thread Tools

how fast is Python?

 
 
Andrew Dalke
Guest
Posts: n/a
 
      08-27-2003
Steven Taschuk:
> A bit off-topic perhaps, but I'd be interested in the details of
> [your] anecdote.


Okay. I know someone who really likes optimized programming.
The kind of person who will develop an in-memory compiler
to generate specialized assembly for the exact parameters used,
thus squeezing out a few extra cycles. He works in a C++ company.
They used an idiom, the details of what I don't know. Most
people wouldn't use that idiom because it didn't translate well
to assembly, but the compiler in theory could figure it out. He
submitted a patch to do that optimization. It was originally
rejected because they couldn't see that anyone would write
code that way. He dug around in gcc itself to find some place
which used that code, to show that it is used. It was accepted.

Moral: it's easier to change the technical details (gcc) than
the social ones (getting people to use a better idiom).

That's about all I know of the story.

Andrew
http://www.velocityreviews.com/forums/(E-Mail Removed)


 
Reply With Quote
 
 
 
 
Graham Fawcett
Guest
Posts: n/a
 
      08-28-2003
(E-Mail Removed) (Cameron Laird) wrote in message news:<(E-Mail Removed)>...
> In article <(E-Mail Removed)>,
> Peter Hansen <(E-Mail Removed)> wrote:
> >dan wrote:
> >>
> >> However, there are definitely cases where a lot of code would need to
> >> be optimized, and so I ask the question: How fast is Python, compared
> >> to say a typical optimizing C/C++ compiler?

> >
> >C is roughly 10 to 100 times faster than Python, though of course it's
> >easy to find cases outside of this range, on either side.
> >
> >I use 30 as a general overall rule of thumb, in the exceptionally
> >few cases where it seems relevant how much faster C would be.
> >
> >And in those very few cases, so far, I have consistently concluded
> >I'm happy enough with the speed of Python given that the speed of
> >*development* in Python is easily 5 to 10 times faster than the
> >speed of development in C. (And again, it's easy to find cases
> >outside of this range, on either side...)

> .
> .
> I just think Peter's wise counsel bears repeating.



My comment is completely off-topic, but I enjoyed a lyrical moment
when I mis-read Cameron's statement, and found myself imagining what
"Peter's wise counsel bears" looked like. I am envious of Peter,
having never made any magical forest-friends myself.

If we each had at least /one/ wise counsel bear, then c.l.py would
certainly reap the benefits of our enhanced posts!

Yours,

-- Graham
 
Reply With Quote
 
 
 
 
Steve Horsley
Guest
Posts: n/a
 
      08-28-2003
On Wed, 20 Aug 2003 22:00:19 +0000, Andrew Dalke wrote:


> Spend a few tens of millions on developing just-in-time compilers
> and program analysis. That worked for Java.


Have you heard of Jython - python language running on a java VM? It's kind
of double interpreted - the python source is converted to JVM bytecode,
and then the JVM runs it however that JVM runs bytecode. I guess it should
be many times faster than python because of the JVM performance, and
wopuld be interested to hear any comparisons.

Steve

 
Reply With Quote
 
Lawrence Oluyede
Guest
Posts: n/a
 
      08-28-2003
"Steve Horsley" <(E-Mail Removed)_SPAM.net> writes:

> Have you heard of Jython - python language running on a java VM? It's kind
> of double interpreted - the python source is converted to JVM bytecode,
> and then the JVM runs it however that JVM runs bytecode. I guess it should
> be many times faster than python because of the JVM performance, and
> wopuld be interested to hear any comparisons.


Jython faster than Python? We did little test and it doesn't seem, look:
http://tinyurl.com/liix

--
Lawrence "Rhymes" Oluyede
http://loluyede.blogspot.com
(E-Mail Removed)
 
Reply With Quote
 
Robin Becker
Guest
Posts: n/a
 
      08-29-2003
In article <(E-Mail Removed)_SPAM.net >, Steve
Horsley <(E-Mail Removed)_SPAM.net> writes
>On Wed, 20 Aug 2003 22:00:19 +0000, Andrew Dalke wrote:
>
>
>> Spend a few tens of millions on developing just-in-time compilers
>> and program analysis. That worked for Java.

>
>Have you heard of Jython - python language running on a java VM? It's kind
>of double interpreted - the python source is converted to JVM bytecode,
>and then the JVM runs it however that JVM runs bytecode. I guess it should
>be many times faster than python because of the JVM performance, and
>wopuld be interested to hear any comparisons.
>
>Steve
>

experience with ReportLab suggests jython can be fairly slow compared to
CPython although it does have advantages.
--
Robin Becker
 
Reply With Quote
 
Andrew MacIntyre
Guest
Posts: n/a
 
      08-29-2003
On Fri, 29 Aug 2003, Robin Becker wrote:

> experience with ReportLab suggests jython can be fairly slow compared to
> CPython although it does have advantages.


The advantages being?

Regards,
Andrew.

--
Andrew I MacIntyre "These thoughts are mine alone..."
E-mail: (E-Mail Removed) (pref) | Snail: PO Box 370
(E-Mail Removed) (alt) | Belconnen ACT 2616
Web: http://www.andymac.org/ | Australia

 
Reply With Quote
 
Lawrence Oluyede
Guest
Posts: n/a
 
      08-29-2003
Andrew MacIntyre <(E-Mail Removed)> writes:

> The advantages being?


I think gain access to Java stuff is an advantage in some situations,
isn't it?

--
Lawrence "Rhymes" Oluyede
http://loluyede.blogspot.com
(E-Mail Removed)
 
Reply With Quote
 
Alan Kennedy
Guest
Posts: n/a
 
      08-29-2003
[Steve Horsley]
>> Have you heard of Jython - python language running on a java VM?
>> It's kind of double interpreted - the python source is converted
>> to JVM bytecode, and then the JVM runs it however that JVM runs
>> bytecode. I guess it should be many times faster than python
>> because of the JVM performance, and wopuld be interested to hear
>> any comparisons.


[Lawrence Oluyede]
> Jython faster than Python? We did little test and it doesn't seem, look:
> http://tinyurl.com/liix


Please bear in mind that the test code included the start up time for
interpreter. For jython, this is a high cost, because starting a JVM
often takes up to 10 seconds or more.

It would probably be fairer to run timings after the VM has already
been through the startup phase. I think that is a more valid
reflection of real-world scenarios where a VM gets started once and
left running for a long time.

regards,

--
alan kennedy
-----------------------------------------------------
check http headers here: http://xhaus.com/headers
email alan: http://xhaus.com/mailto/alan
 
Reply With Quote
 
Lawrence Oluyede
Guest
Posts: n/a
 
      08-29-2003
Alan Kennedy <(E-Mail Removed)> writes:

> Please bear in mind that the test code included the start up time for
> interpreter. For jython, this is a high cost, because starting a JVM
> often takes up to 10 seconds or more.


Yeah, you right. But here comes a question: why do you think that Jython
(and JVM) are faster than Python (and its VM)? In my own little tests is
Jython is always slower and GUI (with Swing) is not responsive as GTK for
example. I think Jython is an amazing and awesome "tool" for Python and
Java developers but I'm not so sure that is also faster than CPython.

Bye!


--
Lawrence "Rhymes" Oluyede
http://loluyede.blogspot.com
(E-Mail Removed)
 
Reply With Quote
 
Juha Autero
Guest
Posts: n/a
 
      08-30-2003
(E-Mail Removed) (Graham Fawcett) writes:

> If we each had at least /one/ wise counsel bear, then c.l.py would
> certainly reap the benefits of our enhanced posts!


That reminds me of a story I probably read from The Practice of
Programming by Brian W. Kernighan and Rob Pike. In some university
(I've forgotten the name) students doing programming exercises had to
explain their problem to a teddy bear before they could talk to course
staff. This was because often just explaining the problem helped you
to understand the problem and then you could fix it.

--
Juha Autero
http://www.iki.fi/jautero/
Eschew obscurity!


 
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
More memory: How fast is fast rfdjr1@optonline.net Computer Support 5 05-19-2004 05:45 PM
Canon S30 Fast shutter mode... Why so fast? mark popp Digital Photography 1 02-08-2004 10:07 PM
I NEED HELP FAST!!!!! REAL FAST!!!!! R. Jizzle MCSE 3 09-29-2003 08:51 PM
Super-fast AA Chargers: Anything as fast as the 15 minute Rayovac? David Chien Digital Photography 4 08-30-2003 07:49 PM



Advertisments