[pypy-svn] r66029 - pypy/extradoc/talk/ep2009/jit
antocuni at codespeak.net
antocuni at codespeak.net
Mon Jun 29 16:10:54 CEST 2009
Author: antocuni
Date: Mon Jun 29 16:10:52 2009
New Revision: 66029
Added:
pypy/extradoc/talk/ep2009/jit/author.latex
- copied, changed from r66027, pypy/extradoc/talk/ep2009/status/author.latex
pypy/extradoc/talk/ep2009/jit/beamerdefs.txt
- copied unchanged from r66027, pypy/extradoc/talk/ep2009/status/beamerdefs.txt
pypy/extradoc/talk/ep2009/jit/fn.py (contents, props changed)
pypy/extradoc/talk/ep2009/jit/jit.txt (contents, props changed)
pypy/extradoc/talk/ep2009/jit/makepdf
- copied, changed from r66027, pypy/extradoc/talk/ep2009/status/makepdf
pypy/extradoc/talk/ep2009/jit/pypy-logo.png
- copied unchanged from r66027, pypy/extradoc/talk/ep2009/status/pypy-logo.png
pypy/extradoc/talk/ep2009/jit/stylesheet.latex
- copied unchanged from r66027, pypy/extradoc/talk/ep2009/status/stylesheet.latex
pypy/extradoc/talk/ep2009/jit/title.latex
- copied unchanged from r66027, pypy/extradoc/talk/ep2009/status/title.latex
Log:
first part of the slides
Copied: pypy/extradoc/talk/ep2009/jit/author.latex (from r66027, pypy/extradoc/talk/ep2009/status/author.latex)
==============================================================================
--- pypy/extradoc/talk/ep2009/status/author.latex (original)
+++ pypy/extradoc/talk/ep2009/jit/author.latex Mon Jun 29 16:10:52 2009
@@ -1,8 +1,8 @@
\definecolor{rrblitbackground}{rgb}{0.0, 0.0, 0.0}
-\title[PyPy status talk]{PyPy status talk}
+\title[PyPy: becoming fast]{PyPy: becoming fast}
\author[antocuni, pedronis, arigo]
-{Samuele Pedroni\\ Armin Rigo\\ Antonio Cuni}
+{Antonio Cuni \\ Samuele Pedroni\\ Armin Rigo\\}
\institute{EuroPython 2009}
\date{June 30 2009}
Added: pypy/extradoc/talk/ep2009/jit/fn.py
==============================================================================
--- (empty file)
+++ pypy/extradoc/talk/ep2009/jit/fn.py Mon Jun 29 16:10:52 2009
@@ -0,0 +1,10 @@
+import dis
+
+def fn(n):
+ tot = 0
+ while n:
+ tot += n
+ n -= 1
+ return tot
+
+dis.dis(fn)
Added: pypy/extradoc/talk/ep2009/jit/jit.txt
==============================================================================
--- (empty file)
+++ pypy/extradoc/talk/ep2009/jit/jit.txt Mon Jun 29 16:10:52 2009
@@ -0,0 +1,177 @@
+.. include:: beamerdefs.txt
+
+================================
+PyPy: becoming fast
+================================
+
+Current status
+===============
+
+- 5th generation of the JIT
+
+- the right one (hopefully :-))
+
+- tracing JIT (like Mozilla TraceMonkey)
+
+- XXX% faster than CPython
+
+- will be much faster in the (near) future
+
+
+Main ideas (1)
+===============
+
+- 80/20 rule
+
+- 80% of the time is spent in 20% of the code
+
+- Optimize only that 20%
+
+
+Main ideas (2)
+===============
+
+- That 20% has to be composed of *loops*
+
+- Recognize **hot** loops
+
+- Optimize hot loops
+
+- Compile to native code
+
+- Execute :-)
+
+
+Recognize hot loops
+====================
+
+|column1| |example<| Example |>|
+::
+
+ def fn(n):
+ tot = 0
+ while n:
+ tot += n
+ n -= 1
+ return tot
+
+|end_example|
+
+|pause|
+
+|column2| |alert<| Bytecode |>|
+|small|
+
+.. raw:: latex
+
+ \smallskip
+ \begin{rtbliteral}
+ ...
+ LOAD\_FAST~~~~~~~~~1~(tot)
+ LOAD\_FAST~~~~~~~~~0~(n)
+ INPLACE\_ADD
+ STORE\_FAST~~~~~~~~1~(tot)
+
+ LOAD\_FAST~~~~~~~~~0~(n)
+ LOAD\_CONST~~~~~~~~2~(1)
+ INPLACE\_SUBTRACT
+ STORE\_FAST~~~~~~~~0~(n)
+ \red{JUMP\_ABSOLUTE~~~~~9}
+ \\...
+ \end{rtbliteral}
+ \smallskip
+
+|end_small|
+|end_alert|
+|end_columns|
+
+
+Tracing
+=========
+
+- Execute one iteration of the hot loop
+
+- Record the operations, as well as the concrete results
+
+- Linear
+
+- Validity ensured by **guards**
+
+- Recovering logic in case of guard failure
+
+
+
+Tracing example
+================
+
+.. image:: step0.pdf
+ :align: center
+ :scale: 60
+
+
+Tracing example
+================
+
+.. image:: step1.pdf
+ :align: center
+ :scale: 60
+
+
+Tracing example
+================
+
+.. image:: step2.pdf
+ :align: center
+ :scale: 60
+
+
+Tracing example
+================
+
+.. image:: step3.pdf
+ :align: center
+ :scale: 60
+
+
+Tracing example
+================
+
+.. image:: step4.pdf
+ :align: center
+ :scale: 60
+
+
+Tracing example
+================
+
+.. image:: step5.pdf
+ :align: center
+ :scale: 60
+
+
+Post-tracing phase
+===================
+
+- Generalize or specialize?
+
+- *Generalized* loops can be used more often
+
+- *Specialized* loops are more efficient
+
+- A trace is super-specialized
+
+
+Perfect specialization
+=======================
+
+- Generalize the trace...
+
+- ...but not too much
+
+- Most general trace which is specialized enough to be efficient
+
+- e.g.: turn Python ``int`` into C-level words
+
+- **specialized**: it works only with ``int`` (and not e.g. ``float``)
+
+- **general**: it works with **all** ``int`` :-)
Copied: pypy/extradoc/talk/ep2009/jit/makepdf (from r66027, pypy/extradoc/talk/ep2009/status/makepdf)
==============================================================================
--- pypy/extradoc/talk/ep2009/status/makepdf (original)
+++ pypy/extradoc/talk/ep2009/jit/makepdf Mon Jun 29 16:10:52 2009
@@ -6,8 +6,8 @@
# WARNING: to work, it needs this patch for docutils
# https://sourceforge.net/tracker/?func=detail&atid=422032&aid=1459707&group_id=38414
-BASE=status
-FINALNAME=pypy-status.pdf
+BASE=jit
+FINALNAME=pypy-jit.pdf
rst2beamer.py --stylesheet=stylesheet.latex --documentoptions=14pt $BASE.txt $BASE.latex || exit
sed 's/\\date{}/\\input{author.latex}/' -i $BASE.latex || exit
sed 's/\\maketitle/\\input{title.latex}/' -i $BASE.latex || exit
More information about the Pypy-commit
mailing list