[pypy-commit] extradoc extradoc: more slides

antocuni noreply at buildbot.pypy.org
Fri Apr 17 00:57:26 CEST 2015


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: extradoc
Changeset: r5533:5ff800bfd872
Date: 2015-04-17 00:40 +0200
http://bitbucket.org/pypy/extradoc/changeset/5ff800bfd872/

Log:	more slides

diff --git a/talk/pycon-italy-2015/talk.rst b/talk/pycon-italy-2015/talk.rst
--- a/talk/pycon-italy-2015/talk.rst
+++ b/talk/pycon-italy-2015/talk.rst
@@ -121,7 +121,102 @@
 
 .. image:: jit-overview3.pdf
    :scale: 50%
-          
+
+
+JIT overview
+-------------
+
+- Tracing JIT
+
+  * detect and compile "hot" loops
+
+  * (although not only loops)
+
+- **Specialization**
+
+- Precompute as much as possible
+
+- Constant propagation
+
+- Aggressive inlining
+
+
+Specialization (1)
+-------------------
+
+- ``obj.foo()``
+
+- which code is executed? (SIMPLIFIED)
+
+  * lookup ``foo`` in obj.__dict__
+
+  * lookup ``foo`` in obj.__class__
+
+  * lookup ``foo`` in obj.__bases__[0], etc.
+
+  * finally, execute ``foo``
+
+- without JIT, you need to do these steps again and again
+
+- Precompute the lookup?
+
+
+Specialization (2)
+--------------------
+
+- pretend and assume that ``obj.__class__`` IS constant
+
+  * "promotion"
+
+- guard
+
+  * check our assumption: if it's false, bail out
+
+- now we can directly jump to ``foo`` code
+
+  * ...unless ``foo`` is in ``obj.__dict__``: GUARD!
+
+  * ...unless ``foo.__class__.__dict__`` changed: GUARD!
+
+- Too many guard failures?
+
+  * Compile some more assembler!
+
+- guards are cheap
+
+  * out-of-line guards even more
+
+
+Specialization (3)
+---------------------
+
+- who decides what to promote/specialize for?
+
+  * we, the PyPy devs :)
+
+  * heuristics
+
+- instance attributes are never promoted
+
+- class attributes are promoted by default (with some exceptions)
+
+- module attributes (i.e., globals) as well
+
+- bytecode constants
+
+
+Specialization trade-offs
+--------------------------
+
+- Too much specialization
+
+  * guards fails often
+
+  * explosion of assembler
+
+- Not enough specialization
+
+  * inefficient code
 
 
 


More information about the pypy-commit mailing list