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 1139.632
IronPython 1751.246
pypy-cli (built-in) 5952.501
pypy-cli 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 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 人工从互联网中收集并分享;
若有不妥, 欢迎评注提醒:


订阅 substack 体验古早写作:

点击注册~> 获得 100$ 体验券: DigitalOcean Referral Badge

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


关于 ~ DebugUself with DAMA ;-)
公安备案号: 44049002000656 ...::