[pypy-commit] extradoc extradoc: some very incomplete slides

antocuni noreply at buildbot.pypy.org
Sun Jun 19 15:53:44 CEST 2011


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: extradoc
Changeset: r3738:0c8941d4ae6b
Date: 2011-06-18 18:39 +0200
http://bitbucket.org/pypy/extradoc/changeset/0c8941d4ae6b/

Log:	some very incomplete slides

diff --git a/talk/ep2011/training/src/gc0.py b/talk/ep2011/training/src/gc0.py
new file mode 100644
--- /dev/null
+++ b/talk/ep2011/training/src/gc0.py
@@ -0,0 +1,7 @@
+def foo():
+    f = file('/tmp/bar.txt', 'w')
+    f.write('hello world')
+    return
+
+foo()
+print file('/tmp/bar.txt').read()
diff --git a/talk/ep2011/training/src/gc1.py b/talk/ep2011/training/src/gc1.py
new file mode 100644
--- /dev/null
+++ b/talk/ep2011/training/src/gc1.py
@@ -0,0 +1,8 @@
+def foo():
+    f = file('/tmp/bar.txt', 'w')
+    f.write('hello world')
+    f.close()
+    return
+
+foo()
+print file('/tmp/bar.txt').read()
diff --git a/talk/ep2011/training/src/gc2.py b/talk/ep2011/training/src/gc2.py
new file mode 100644
--- /dev/null
+++ b/talk/ep2011/training/src/gc2.py
@@ -0,0 +1,6 @@
+def foo():
+    with file('/tmp/bar.txt', 'w') as f:
+        f.write('hello world')
+
+foo()
+print file('/tmp/bar.txt').read()
diff --git a/talk/ep2011/training/talk.rst b/talk/ep2011/training/talk.rst
--- a/talk/ep2011/training/talk.rst
+++ b/talk/ep2011/training/talk.rst
@@ -5,3 +5,117 @@
 ================================
 
 PyPy training session
+---------------------
+
+- Part 1: Run your application under PyPy
+
+- Part 2: Write your own interpreter with PyPy
+
+
+Part 1
+------
+
+* Run your application under PyPy
+
+
+How to run PyPy
+----------------
+
+* ``pypy program.py``
+
+* That's it!
+
+
+Refcounting vs generational GC (1)
+----------------------------------
+
+|scriptsize|
+|example<| |scriptsize| ``gc0.py`` |end_scriptsize| |>|
+
+.. sourcecode:: python
+
+   def foo():
+       f = file('/tmp/bar.txt', 'w')
+       f.write('hello world')
+
+   foo()
+   print file('/tmp/bar.txt').read()
+
+|end_example|
+
+|pause|
+|example<| |scriptsize| ``gc1.py`` |end_scriptsize| |>|
+
+.. sourcecode:: python
+
+   def foo():
+       f = file('/tmp/bar.txt', 'w')
+       f.write('hello world')
+       f.close() # <-------
+
+|end_example|
+
+|pause|
+|example<| |scriptsize| ``gc2.py`` |end_scriptsize| |>|
+
+.. sourcecode:: python
+
+   def foo():
+       with file('/tmp/bar.txt', 'w') as f:
+           f.write('hello world')
+
+|end_example|
+|end_scriptsize|
+
+
+Refcounting vs generational GC (2)
+----------------------------------
+
+* ``__del__``
+
+  - especially files or sockets
+
+  - don't leak file descriptors!
+
+* weakrefs
+
+* ``finally`` inside generators
+
+Challenge
+---------
+
+- Find the bug!
+
+XXX write me :-(
+
+
+How the JIT works
+-----------------------
+
+XXX write me
+
+
+PYPYLOG
+--------
+
+* ``PYPYLOG=categories:logfile pypy program.py``
+
+* categories:
+
+  - gc
+
+  - jit-log-noopt, jit-log-opt
+
+  - jit-backend
+
+  - jit-backend-counts
+
+* ``PYPYLOG=jit-log-opt:log.pypylog pypy foo.py``
+
+XXX: write foo.py
+
+
+The jitviewer
+-------------
+
+- ``jitviewer.py log.pypylog``


More information about the pypy-commit mailing list