Hi Amaury, On 09/15/2010 01:11 AM, Amaury Forgeot d'Arc wrote: > 2010/9/15 Saravanan Shanmugham<[email protected]>: >> I don't expect this python compiler to be for full python but just a >> Restricted >> statically typed subset of python as defined by Shedskin. >> >> Yes. JIT annotation may not serve the purpose of generating a compiler. >> Hence the porting of the type inference engine and may be use JIT notations >> if >> it can be. > > I've downloaded and read the source code of shedskin. >> From what I understand, here are some differences between PyPy and Shedksin. > > - Shedskin analyses and generates code directly by walking the AST of a python > module. (there are two passes: the first to grab information about global > types > and functions, the second to emit code) > > - Shedskin does very little type inference. Shedskin's type system is based on > C++ templates, and once a variable's type has been determined, generic code is > emitted and the C++ compiler will select the correct implementation. Other > inference engines also work on the AST; Logilab's pylint, for example, works > much harder to check all instructions and the type of all variables. Shedskin > does not seem to need such power. > > - On the other hand, PyPy analyzes imported modules, and works on the bytecode > of functions living in memory. It does a complete type inference and emits > low-level C code or Java intermediate representation. > > - PyPy has its own way to write generic code and templates, the language for > meta-programming is Python itself! [I'm referring to loops that > generate classes and functions, and things like "specialize:argtype(0)", > "unrolling_iterable" combined with constant propagation]. > > In most cases, PyPy does not generate better code than Shedskin. When Shedskin > compiles code, it does it well. And its restrictions are easier to work with; > RPython is really tricky to get right sometimes.
Nice analysis and description, thank you! Carl Friedrich _______________________________________________ [email protected] http://codespeak.net/mailman/listinfo/pypy-dev
