开发者

How does ironpython speed compare to other .net languages?

I would like to give sources for what I'm say开发者_运维百科ing but I just dont have them, it's something I heard.

Once a programming professor told me that some software benchmarking done to .net vs Python in some particular items it gave a relation of 5:8 in favor of .NET . That was his argument in favor of Python not being so much slower than .NET

Here it's the thing, I would like to try IronPython since I could combine the web framework I know the most (asp.net) with the language I like the most (Python) and I was wondering about the speed of programs in asp.net in Python vs the speed of programs in ASP.NET with VB.net or C#. Is there any software benchmarking on this?

Also, shouldnt the speeds of IronPython compared to other .NET languages be similar, since IronPython unlike Python have to compile to the .NET intermediate code? Can someone enlight me on these issues?

Greetings


Here are two interesting links with comparisons between IronPython, CPython, and C# (among others):

  • CPython vs C# (Mono) benchmarks, based on several programs detailed on the site.
  • CPython vs IronPython benchmarks, based on PyStone and PyBench, for versions 2.6.

So apparently it does along the lines of what your professor told you. But as you know, it depends so much on what you are using.

The difference is mainly due to the dynamic nature of the objects used in Python, whereas C# is strongly typed. So IronPython uses one more level (the DLR - Dynamic Language Runtime) on top of what C# is run from (the CLR - the Common Language Runtime), to resolve this difference.

I usually hate to cite Wikipedia articles, but this is a good starting point: http://en.wikipedia.org/wiki/Dynamic_Language_Runtime

Now to come back to your project, the performances will probably be more dependent on your algorithms/heuristics - how you query a database for example - than on the language. If you are familiar with a web framework and are happy with it, it's a good idea to stick with the same environment rather than gain a possible few percents on something you'll have to tame first. It wouldn't be the same if the application was CPU-intensive of course.


You could enable .net tracing, which outputs timing information at the bottom of the page. Make an app in C#/.Net and an app using Python and look at the differences in timing. That will give you a definitive answer.

In all honesty I think you're better off just using C#, it's "faster" to develop since the VS environment is there for you and it's going to run faster since it doesn't have to use the dynamic language runtime.


IronPython will be considerably slower than C#. You could think of the comparison as very roughly between CPython and C, but with the gap somewhat smaller.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜