Valentino Volonghi aka Dialtone wrote: > Michael Sparks <[EMAIL PROTECTED]> wrote: > >> Would it be useful for people to start trying out their modules/code to >> see if they work with this release, and whether they can likewise be >> translated using the C/LLVM backends, or would you say this is too early? >> (I'm more thinking in terms of it providing real world usecases in the >> hope of finding things that don't work - rather than anything else) > > This is not how it works.
I beg to differ - it is how it can work (just not the default or currently recommended). Currently the biggest, most interesting example is this: (from the getting started page, compiling pypy) cd pypy/translator/goal python translate_pypy.py Which has just finished executing on my machine and took about 3 hours to complete (partly because the cc1 process reached ~780MB in terms of memory footprint and my machine has 512Mb). However it goes on to talk about compiling other things: """You can also use the translate_pypy.py script to try out several smaller programs, e.g. a slightly changed version of Pystone: cd pypy/translator/goal python translate_pypy.py targetrpystone """ Which is pretty cool of course. For those of interest running pystone with the pypy compiled native binary has the following results for pystones on my machine: [EMAIL PROTECTED]:~/pypy-0.7.0/pypy/translator/goal> ./pypy-c debug: entry point starting debug: argv -> ./pypy-c debug: importing code debug: calling code.interact() Python 2.4.1 (pypy 0.7.0 build) on linux2 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>>> from test import pystone >>>> pystone.main(1000) Pystone(1.1) time for 1000 passes = 13.97 This machine benchmarks at 71.582 pystones/second >>>> The same results for CPython: [EMAIL PROTECTED]:~/pypy-0.7.0/pypy/translator/goal> python Python 2.4 (#1, Mar 22 2005, 21:42:42) [GCC 3.3.5 20050117 (prerelease) (SUSE Linux)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from test import pystone >>> pystone.main() Pystone(1.1) time for 50000 passes = 1.58 This machine benchmarks at 31645.6 pystones/second Obviously therefore anyone seeking to translate their existing code from python to an executable directly using pypy would not be doing it for performance reasons (again, something I'm aware of watching the updates come out and having run svn checkouts at previous times). (Factor of ~450 though is pretty d*^%n cool though :) I'm also well aware of the difference between python and rpython :-) > Pypy doesn't translate your code to C/LLVM. > Currently PyPy can only translate a pretty simple subset of python > called RPython which has a very C-like syntax (but without memory > management code). This is needed to allow type inference inside the > interpreter code. > > The code in your application is application code and can be whatever you > want, you may try to translate it to C/LLVM but it won't be that good of > course because the annotator is not that intelligent. *Shrug* Seemed pretty good at annotating and compiling a module longer than many of mine at Europython, and then compiled using the LLVM backed. :) Anyway, whether it's sensible or not I'm going to play with translating some of my modules :) Regards, Michael. -- http://mail.python.org/mailman/listinfo/python-list