[pypy-commit] extradoc extradoc: finish the talk (more or less)

antocuni noreply at buildbot.pypy.org
Fri Jun 17 17:17:38 CEST 2011


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: extradoc
Changeset: r3732:2f5686832a7c
Date: 2011-06-17 17:21 +0200
http://bitbucket.org/pypy/extradoc/changeset/2f5686832a7c/

Log:	finish the talk (more or less)

diff --git a/talk/ep2011/talk/beamerdefs.txt b/talk/ep2011/talk/beamerdefs.txt
--- a/talk/ep2011/talk/beamerdefs.txt
+++ b/talk/ep2011/talk/beamerdefs.txt
@@ -28,6 +28,9 @@
 
    }
 
+.. |strike<| raw:: latex
+
+   \sout{
 
 .. closed bracket
 .. ===========================
@@ -85,6 +88,21 @@
    \end{columns}
 
 
+
 .. |snake| image:: ../../img/py-web-new.png
            :scale: 15%
            
+
+
+.. nested blocks
+.. ===========================
+
+.. |nested| raw:: latex
+
+   \begin{columns}
+      \begin{column}{0.85\textwidth}
+
+.. |end_nested| raw:: latex
+
+      \end{column}
+   \end{columns}
diff --git a/talk/ep2011/talk/ctypesbench.py b/talk/ep2011/talk/ctypesbench.py
new file mode 100644
--- /dev/null
+++ b/talk/ep2011/talk/ctypesbench.py
@@ -0,0 +1,22 @@
+import time
+N = 10000000
+
+def main(N):
+    import ctypes
+    libm = ctypes.CDLL('libm.so')
+    pow = libm.pow
+    pow.argtypes = [ctypes.c_double, ctypes.c_double]
+    pow.restype = ctypes.c_double
+    #
+    i = 0
+    res = 0
+    start = time.clock()
+    while i < N:
+        res += pow(2, 3)
+        i += 1
+    end = time.clock()
+    print 'total:', end-start
+    return res
+
+
+main(N)
diff --git a/talk/ep2011/talk/question-mark.png b/talk/ep2011/talk/question-mark.png
new file mode 100644
index 0000000000000000000000000000000000000000..c15378b85f7ba141ed6dd631c8b249da91003538
GIT binary patch

[cut]

diff --git a/talk/ep2011/talk/stylesheet.latex b/talk/ep2011/talk/stylesheet.latex
--- a/talk/ep2011/talk/stylesheet.latex
+++ b/talk/ep2011/talk/stylesheet.latex
@@ -1,3 +1,4 @@
+\usepackage{ulem}
 \usetheme{Boadilla}
 \usecolortheme{whale}
 \setbeamercovered{transparent}
diff --git a/talk/ep2011/talk/talk.rst b/talk/ep2011/talk/talk.rst
--- a/talk/ep2011/talk/talk.rst
+++ b/talk/ep2011/talk/talk.rst
@@ -236,8 +236,14 @@
    :align: center
 
 
-Why Python is slow?
--------------------
+Is Python slow?
+----------------
+
+- |strike<| Python is slow |>|
+
+- Python is hard to optimize
+
+|pause|
 
 - Huge stack of layers over the bare metal
 
@@ -264,7 +270,7 @@
 
       def __add__(self, q):
         if not isinstance(q, Point):
-            raise TypeError
+          raise TypeError
         x1 = self.x + q.x
         y1 = self.y + q.y
         return Point(x1, y1)
@@ -441,8 +447,8 @@
 Concrete example: ``ctypes``
 ----------------------------
 
+|scriptsize|
 |example<| |>|
-|scriptsize|
 
 .. sourcecode:: python
 
@@ -451,7 +457,73 @@
     pow = libm.pow
     pow.argtypes = [ctypes.c_double, ctypes.c_double]
     pow.restype = ctypes.c_double
+    pow(2, 3) # <---
+
+|end_example|
+|end_scriptsize|
+
+Layers and layers
+----------------------------
+
+.. raw:: latex
+
+   \setbeamercovered{invisible}
+
+
+|scriptsize|
+
+|example<| |small| ``CFuncPtrFast.__call__`` (Python) |end_small| |>|
+check that the cache is still valid |pause|
+
+|nested| |example<| |small| ``CFuncPtrFast._call_funcptr`` (Python) |end_small| |>|
+some runtime checks (e.g. ``_flags_``) |pause|
+
+|nested| |example<| |small| ``_ffi.FuncPtr.__call__`` (RPython) |end_small| |>|
+typecheck/unbox arguments, put them in raw C buffers |pause|
+
+|nested| |example<| |small| ``c_ffi_call`` (C) [libffi.so] |end_small| |>|
+takes arguments from the raw C buffers |pause|
+
+|nested| |alert<| |small| ``pow at 0xf72de000`` (C) [libm.so]  |end_small| |>|
+return 8
+
+|end_alert| |end_nested|
+|end_example| |end_nested|
+|end_example| |end_nested|
+|end_example| |end_nested|
+|end_example|
 
 |end_scriptsize|
-|end_example|
 
+``ctypes`` demo
+----------------
+
+Conclusion
+----------
+
+- PyPy is fast
+
+- mature
+
+- stable
+
+- abstractions for free!
+
+|pause|
+
+- (I wonder why you all are still here instead of busy trying PyPy :-))
+
+Contacts, Q/A
+--------------
+
+- http://pypy.org
+
+- blog: http://morepypy.blogspot.com
+
+- mailing list: pypy-dev (at) python.org
+
+- IRC: #pypy on freenode
+
+.. image:: question-mark.png
+   :scale: 10%
+   :align: center


More information about the pypy-commit mailing list