Can A Python Go Beyond The Python
-
Upload
yusuke-muraoka -
Category
Technology
-
view
1.884 -
download
0
Transcript of Can A Python Go Beyond The Python
?
PyPy?
PythonPython
RPython
Python
Python
(AST)
Pure Python
Django, Pylons, BitTorrent, Twisted, SymPy, Pyglet, Nevow, Pinax
# >>>> __pytrace__ = 1Tracing enabled>>>> a = 1 + 2|- >|- 0 LOAD_CONST 1 (W_IntObject(3))|- 3 STORE_NAME 0 (a) |- hash(W_StringObject('a')) -> W_IntObject(-468864544) |- int_w(W_IntObject(-468864544)) -> -468864544|- 6 LOAD_CONST 0 ()|- 9 RETURN_VALUE|- >
PyPy?
PythonPython
RPython
Python
Python
Restricted Python
yield
http://codespeak.net/pypy/dist/pypy/doc/coding-guide.html
PyPy?
PythonPython
RPython
Python
Prolog
GC
C, CLI, JVM
Stackless
JIT
JIT
?()
JIT?
JIT?
PyPyJIT
Just In Time
Sun JVMHotSpot
TraceMonkeyV8
(V8JIT)
http://www.slideshare.net/dynamis/trace-monkey?type=presentation
JIT?
JIT?
PyPyJIT
Tracing JIT
Trace Monkey
psyco
PyPy
def f(a, b) if b % 46 == 41: return a - b else: return a + b
def strange_sum(n): result = 0 while n >= 0: result = f(result, n) n -= 1return result
# corresponding trace:
loop_header(result0, n0)
i0 = int_mod(n0, Const(46))
i1 = int_eq(i0, Const(41))
guard_false(i1)
result1 = int_add(result0, n0)
n1 = int_sub(n0, Const(1))
i2 = int_ge(n1, Const(0))
guard_true(i2)
jump(result1, n1)