PyPy and .NET

emoticon:computer The big news in the PyPy world of course, is that they have just released version 1.0. This includes a very powerful, only partially working (so far), JIT compiler. What is most incredible, is that the JIT compiler is compiled 'dynamically' for the front-end language spec. That means any interpreter written in RPython!

When trying to understand what PyPy is useful for, I've found this explanation (by Chris Lattner) helpful:

pypy provides infrastructure for building interpreters in [r]python. This infrastructure makes it much easier than starting from scratch, e.g. by providing reusable components for language runtimes (like GC's).

That aside, an interesting aspect of PyPy is the CLI Backend [1]. The guts of the CLI backend is GenCLI.

GenCLI takes RPython applications, and turns them into native (IL - CLR bytecode) .NET executables.

The code GenCLI produces is slightly slower than C#, but massively faster than Python or IronPython (tested with Martin Richard's Benchmark) :

Language Speed (average time per iteration)
richards-c# 7.093
richards-gencli 13.312
CPython richards.py 1139.632
IronPython richards.py 1751.246
pypy-cli richards.py (built-in) 5952.501
pypy-cli richards.py 12010.541

This is interesting to us at Resolver, because we have some C#, and may also be interested in performance optimisations for some of our core classes. The option of writing in RPython rather than C# is an attractive one!

There are a few problems with this (i.e. it can't currently be done):

  • GenCLI generates executables rather than class libraries
  • The classes it generates have their attributes name mangled
  • All attributes and methods are public
  • GenCLI expects a single entry point (for applications), for class libraries it would need to support multiple entry points (with a way to express this in RPython, including the types of their arguments)
  • No support for custom .NET attributes (the main reason we currently write C# by hand)
  • Only limited support for accessing .NET libraries

The main developer of GenCLI is Antonio Cuni, who will be continuing the development as part of his Phd thesis. At least partly because of the interest from us, he will be looking at working on the changes necessary to make RPython a useful (and fast!) .NET development language. Cool

[1]You can read more about the CLI backend in their EU report: High Level backends, which is pretty readable as these things go.

Like this post? Digg it or Del.icio.us it. Looking for a great tech job? Visit the Hidden Network Jobs Board.

Posted by Fuzzyman on 2007-03-30 23:34:41 | |

Categories: , ,

::...
免责声明:
当前网页内容, 由 大妈 ZoomQuiet 使用工具: ScrapBook :: Firefox Extension 人工从互联网中收集并分享;
内容版权归原作者所有;
本人对内容的有效性/合法性不承担任何强制性责任.
若有不妥, 欢迎评注提醒:

或是邮件反馈可也:
askdama[AT]googlegroups.com



自怼圈/年番新

DU21.4
关于 ~ DebugUself with DAMA ;-)


关注公众号, 持续获得相关各种嗯哼:
zoomquiet


粤ICP备18025058号-1
公安备案号: 44049002000656 ...::