IronPython faster than CPython?

J

Jack

I learned a lot from the other thread 'Is a "real" C-Python possible?' about
Python performance and optimization. I'm almost convinced that Python's
performance is pretty good for this dynamic language although there are
areas to improve, until I read some articles that say IronPython is a few
times faster. I find it amazing that something that's written in C and runs
on hardware is slower than a .NET app that runs on CLR as managed code:

http://www.python.org/~jeremy/weblog/031209a.html
http://blogs.msdn.com/jasonmatusow/archive/2005/03/28/402940.aspx
 
J

John Machin

I learned a lot from the other thread 'Is a "real" C-Python possible?' about
Python performance and optimization. I'm almost convinced that Python's
performance is pretty good for this dynamic language although there are
areas to improve, until I read some articles that say IronPython is a few
times faster. I find it amazing that something that's written in C and runs
on hardware is slower than a .NET app that runs on CLR as managed code:

http://www.python.org/~jeremy/weblog/031209a.html

Four years old. IP 0.1 vs CP 2.3. Sheesh.

Close to 3 years old but somewhat more meaningful ...

"""IronPython 0.7 is up to 1.8x faster than Python-2.4 on the standard
pystone benchmark. The key to IronPython's performance is that it
compiles Python code to .NET Intermediary Language which is then
translated to optimized machine code by the runtime."""

Where did you get "a few times faster" from?
 
M

Mark Shroyer

"Jack said:
I learned a lot from the other thread 'Is a "real" C-Python possible?' about
Python performance and optimization. I'm almost convinced that Python's
performance is pretty good for this dynamic language although there are
areas to improve, until I read some articles that say IronPython is a few
times faster. I find it amazing that something that's written in C and runs
on hardware is slower than a .NET app that runs on CLR as managed code:

http://www.python.org/~jeremy/weblog/031209a.html
http://blogs.msdn.com/jasonmatusow/archive/2005/03/28/402940.aspx

You might argue that Python programs executed using CPython "run on
hardware" to a *lesser* extent than they do when run in IronPython. In
either case, your program is parsed and compiled into bytecode (Python
bytecode or MSIL), then loaded by the Python virtual machine or the .NET
VM, respectively. But whereas the Python VM is a bytecode interpreter,
the .NET VM, like Java, uses just-in-time compilation to translate MSIL
bytecode to optimized machine code for more efficient execution. This
is probably the most important factor in the performance difference
demonstrated in the above links.

The fact that the IronPython compiler is written in C# and therefore
runs from the VM, whereas the CPython compiler is compiled straight to
machine code, is unimportant. Even if a significant performance
difference did result from this, keep in mind that the bulk of the
execution time of any Python app worth profiling is going to be after
this initial Python-to-bytecode compilation, during the execution of the
program's bytecode itself.
 
R

Ross Ridge

Jack said:
I learned a lot from the other thread 'Is a "real" C-Python possible?' about
Python performance and optimization. I'm almost convinced that Python's
performance is pretty good for this dynamic language although there are
areas to improve, until I read some articles that say IronPython is a few
times faster.

In my limitted experience, IronPython is slower than CPython. I can't
actually get much to run with IronPython, but what I have been able
to get working runs slower. In particular initialization time takes
much longer. A command line utility of mine that takes 1.5 seconds to
run with CPython, ends up taking 20 seconds with IronPython. That 3
seconds for IronPython's own startup and initilization, 12 seconds for
importing modules, and 5 seconds for the rest.

Ross Ridge
 

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,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top