471,354 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

IronPython faster than CPython?

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/a...28/402940.aspx
Dec 18 '07 #1
3 2197
On Dec 19, 9:18 am, "Jack" <nos...@invalid.comwrote:
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.
http://blogs.msdn.com/jasonmatusow/a...28/402940.aspx
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?
Dec 18 '07 #2
In article <AK******************************@comcast.com>,
"Jack" <no****@invalid.comwrote:
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/a...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.

--
Mark Shroyer
http://markshroyer.com/contact/
Dec 18 '07 #3
Jack <no****@invalid.comwrote:
>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

--
l/ // Ross Ridge -- The Great HTMU
[oo][oo] rr****@csclub.uwaterloo.ca
-()-/()/ http://www.csclub.uwaterloo.ca/~rridge/
db //
Dec 20 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Ajay | last post: by
8 posts views Thread by John Salerno | last post: by
3 posts views Thread by Carl Johan Rehn | last post: by
3 posts views Thread by Sanghyeon Seo | last post: by
9 posts views Thread by Luis M. González | last post: by
2 posts views Thread by tkpmep | last post: by
9 posts views Thread by Claudio Grondi | last post: by
22 posts views Thread by dmitrey | last post: by
1 post views Thread by jmDesktop | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.