[IronPython] is the performance gap between C and CPython a decent comparision between the performance gap between C# and IronPython?

Michael Foord fuzzyman at voidspace.org.uk
Wed Apr 14 18:48:50 CEST 2010


Hello Pablo,

Python is an expressive and highly dynamic language. As such it is 
typically possible to achieve things in less lines of code and fewer 
layers of architecture when writing idiomatic Python as compared to 
idiomatic C#. With less code often comes better performance. This really 
has been my experience and that of many people switching from statically 
typed languages like C# and Java.

*However*, if you transliterate C# code (particularly algorithmic code 
as used by most synthetic benchmarks) to the direct equivalent in 
IronPython you *will* see C# running considerably faster.

The answer is three-fold:

* You don't write the same code in C# and Python
* With a less restrictive language and less verbose language you have 
*more time* for performance optimisation - the bottlenecks in even 
computationally expensive code is typically the *way* your algorithms 
are implemented and *not* the language used
* With IronPython integrating with C# is almost absurdly easy - so 
moving your performance sensitive code into C# after appropriate 
profilling and prototyping in IronPython is not hard

Choosing a programming language based on its perceived performance 
characteristics is a premature optimisation.

All the best,

Michael Foord

On 14/04/2010 13:52, Pablo Dalmazzo wrote:
> Hi there,
>
> I was replied in one of my topics in StackOverflow that the gap 
> performance between C with cPython  is comparable with the performance 
> gap between with C# with IronPython by some guy I dont know who he is. 
> It could be a newbie, it could not. Now since the base 
> language/platform are very differents my guess is his comparision is 
> way off, but since I hadnt have time to take a look to the IronPython 
> sourcecode at all, even if I want to do it soon, I have no idea if 
> what he says has any sense or not. Now it's a known fact the gap 
> between C and (c)Python is huge, is that a decent comparision of the 
> level of performance difference between C# and IronPython? I think if 
> it's not, someone should reply him with some technical(s) details why 
> not, I was asked if that was true by a programmer friend and she didnt 
> got much confidence in IronPython by reading that
>
> Greetings, Pablo
> ------------------------------------------------------------------------
> Con Hotmail no pierdas tiempo. Organizá tus emails en carpetas y 
> encontralos rápido. Conocé cómo 
> <http://www.descubrewindowslive.com/hotmail/organizacion.asp>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>    


-- 
http://www.ironpythoninaction.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100414/f3d0669a/attachment.html>


More information about the Ironpython-users mailing list