how fast is Python?

A

Andrew Dalke

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
(e-mail address removed)
 
G

Graham Fawcett

.
.
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
 
S

Steve Horsley

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
 
L

Lawrence Oluyede

Steve Horsley said:
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
 
R

Robin Becker

Steve said:
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.
 
A

Andrew MacIntyre

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

The advantages being?

Regards,
Andrew.
 
A

Alan Kennedy

[Steve Horsley]
[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,
 
L

Lawrence Oluyede

Alan Kennedy said:
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!
 
J

Juha Autero

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.
 
M

Marc Wilson

in <[email protected]>::

|[email protected] (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.

The term I coined for this is "echo debugging". :)
--
Marc Wilson

Cleopatra Consultants Limited - IT Consultants
2 The Grange, Cricklade Street, Old Town, Swindon SN1 3HG
Tel: (44/0) 70-500-15051 Fax: (44/0) 870 164-0054
Mail: (e-mail address removed) Web: http://www.cleopatra.co.uk
_________________________________________________________________
Try MailTraq at https://my.mailtraq.com/register.asp?code=cleopatra
 
P

Peter Hansen

Marc said:
in <[email protected]>::

|[email protected] (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.

The term I coined for this is "echo debugging". :)

I once spent about two hours in a debugging session with a friend.
We were away from the computer, discussing the problem, with a
whiteboard, diagrams, lots of talking.... after we found the
solution I said something about wow, that's great, we solved it.

My friend said, "Peter... _I_ didn't even say anything!". :)

-Peter
 

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,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top