Submitted for everyone's approval, I've written a draft of a pypy tutorial going over everything I learned in writing this example interpreter.

https://bitbucket.org/brownan/pypy-tutorial/src

See the main document at tutorial.rst

I'd love some feedback on it. I've made an effort to keep things accurate yet simple, but if there are any inaccuracies, let me know. Or fork the repo and make the correction yourself =)

-Andrew

On Thu, Mar 31, 2011 at 6:29 PM, Alex Gaynor <alex.gaynor@gmail.com> wrote:


On Thu, Mar 31, 2011 at 6:00 PM, Antonio Cuni <anto.cuni@gmail.com> wrote:
On 31/03/11 22:05, Andrew Brown wrote:

> python double-interpreted: > 78m (did not finish)
> pypy-c (with jit) double-interpreted: 41m 34.528s

this is interesting. We are beating cpython by more than 2x even in a "worst
case" scenario, because interpreters in theory are not a very good target for
tracing JITs.
However, it's not the first time that we experience this, so it might be that
this interpreter/tracing JIT thing is just a legend :-)


Well the issue with tracing an interpreter is the large number of paths, a brainfuck interpreter has relatively few paths compared to something like a Python VM.


 
> translated interpreter no jit: 45s
> translated interpreter jit: 7.5s
> translated direct to C, gcc -O0
>   translate: 0.2s
>   compile: 0.4s
>   run: 18.5s
> translated direct to C, gcc -O1
>   translate: 0.2s
>   compile: 0.85s
>   run: 1.28s
> translated direct to C, gcc -O2
>   translate: 0.2s
>   compile: 2.0s
>   run: 1.34s

these are cool as well. We are 3x faster than gcc -O0 and ~3x slower than -O1
and -O2.  Pretty good, I'd say :-)

ciao,
anto
_______________________________________________
pypy-dev@codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev

Alex

--
"I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero