Author: Hakan Ardo <ha...@debian.org> Branch: extradoc Changeset: r4806:05aecd80978d Date: 2012-09-13 11:18 +0200 http://bitbucket.org/pypy/extradoc/changeset/05aecd80978d/
Log: merge diff --git a/talk/googlezurich2012/Makefile b/talk/googlezurich2012/Makefile new file mode 100644 --- /dev/null +++ b/talk/googlezurich2012/Makefile @@ -0,0 +1,17 @@ +# you can find rst2beamer.py here: +# http://codespeak.net/svn/user/antocuni/bin/rst2beamer.py + +# WARNING: to work, it needs this patch for docutils +# https://sourceforge.net/tracker/?func=detail&atid=422032&aid=1459707&group_id=38414 + +talk.pdf: talk.rst author.latex title.latex stylesheet.latex + rst2beamer.py --stylesheet=stylesheet.latex --documentoptions=14pt talk.rst talk.latex || exit + sed 's/\\date{}/\\input{author.latex}/' -i talk.latex || exit + sed 's/\\maketitle/\\input{title.latex}/' -i talk.latex || exit + pdflatex talk.latex || exit + +view: talk.pdf + evince talk.pdf & + +xpdf: talk.pdf + xpdf talk.pdf & diff --git a/talk/googlezurich2012/author.latex b/talk/googlezurich2012/author.latex new file mode 100644 --- /dev/null +++ b/talk/googlezurich2012/author.latex @@ -0,0 +1,8 @@ +\definecolor{rrblitbackground}{rgb}{0.0, 0.0, 0.0} + +\title[PyPy in Production]{PyPy} +\author[Armin Rigo] +{Armin Rigo} + +\institute{Google 2012} +\date{September 12, 2012} diff --git a/talk/googlezurich2012/beamerdefs.txt b/talk/googlezurich2012/beamerdefs.txt new file mode 100644 --- /dev/null +++ b/talk/googlezurich2012/beamerdefs.txt @@ -0,0 +1,108 @@ +.. colors +.. =========================== + +.. role:: green +.. role:: red + + +.. general useful commands +.. =========================== + +.. |pause| raw:: latex + + \pause + +.. |small| raw:: latex + + {\small + +.. |end_small| raw:: latex + + } + +.. |scriptsize| raw:: latex + + {\scriptsize + +.. |end_scriptsize| raw:: latex + + } + +.. |strike<| raw:: latex + + \sout{ + +.. closed bracket +.. =========================== + +.. |>| raw:: latex + + } + + +.. example block +.. =========================== + +.. |example<| raw:: latex + + \begin{exampleblock}{ + + +.. |end_example| raw:: latex + + \end{exampleblock} + + + +.. alert block +.. =========================== + +.. |alert<| raw:: latex + + \begin{alertblock}{ + + +.. |end_alert| raw:: latex + + \end{alertblock} + + + +.. columns +.. =========================== + +.. |column1| raw:: latex + + \begin{columns} + \begin{column}{0.45\textwidth} + +.. |column2| raw:: latex + + \end{column} + \begin{column}{0.45\textwidth} + + +.. |end_columns| raw:: latex + + \end{column} + \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/googlezurich2012/standards.png b/talk/googlezurich2012/standards.png new file mode 100644 index 0000000000000000000000000000000000000000..5d38303773dd4f1b798a91bec62d05e0423a6a0d GIT binary patch [cut] diff --git a/talk/googlezurich2012/stylesheet.latex b/talk/googlezurich2012/stylesheet.latex new file mode 100644 --- /dev/null +++ b/talk/googlezurich2012/stylesheet.latex @@ -0,0 +1,12 @@ +\usepackage{ulem} +\usetheme{Boadilla} +\usecolortheme{whale} +\setbeamercovered{transparent} +\setbeamertemplate{navigation symbols}{} + +\definecolor{darkgreen}{rgb}{0, 0.5, 0.0} +\newcommand{\docutilsrolegreen}[1]{\color{darkgreen}#1\normalcolor} +\newcommand{\docutilsrolered}[1]{\color{red}#1\normalcolor} + +\newcommand{\green}[1]{\color{darkgreen}#1\normalcolor} +\newcommand{\red}[1]{\color{red}#1\normalcolor} diff --git a/talk/googlezurich2012/talk.rst b/talk/googlezurich2012/talk.rst new file mode 100644 --- /dev/null +++ b/talk/googlezurich2012/talk.rst @@ -0,0 +1,203 @@ +.. include:: beamerdefs.txt + +============================================================ +PyPy +============================================================ + + +PyPy is... +-------------------------- + +* Another Python interpreter + +* with a JIT compiler + + +PyPy was... +------------------- + +* Around since 2003 + +* (advertised as) production ready since December 2010 + + - release 1.4 + +* Funding + + - EU FP6 programme + + - Eurostars programme + + - donations + + - ... + + +PyPy 1.9: current status +------------------------ + +* Faster + + - **1.7x** than 1.5 (Summer 2011) + + - **2.2x** than 1.4 (December 2010) + + - **5.5x** than CPython + +* Implements Python 2.7.3 + +* Many more "PyPy-friendly" programs than before + +* Packaging + + - |scriptsize| Debian, Ubuntu, Fedora, Homebrew, Gentoo, ArchLinux, ... |end_scriptsize| + + - |scriptsize| Windows (32bit only), OS X |end_scriptsize| + +* C extension compatibility + + - runs (big part of) **PyOpenSSL** and **lxml** + + +PyPy organization +----------------- + +* Part of SFC -- Software Freedom Conservancy + + - Bradley successfully fighting U.S. bureaucracy + + - we are happy about it + + +* Funding model + + - py3k, numpy, STM + + - more than 100'000$ in donations + + - from individuals, large companies and the PSF + + +PyPy's JIT compiler +------------------- + +* Removes abstraction + +* Almost never gives up + +* x86-32, x86-64, ARMv7, (POWER64) + +* (Works with other languages) + + +Real world applications +----------------------- + +* Positive feedback + +* http://speed.pypy.org/ + +* demo + + +py3k +------------------------ + +* ``py3k`` branch in mercurial + + - developed in parallel + + - Python 3 written in Python 2 + +* Focus on correctness + +* Dropped some interpreter optimizations for now + +* First 90% done, remaining 90% not done + +* Majority of the funds by Google + + +NumPy +----- + +* progress going slowly + +* multi dimensional arrays, broadcasting, fancy indexing + +* all dtypes, except complex, strings and objects + +* good results for performance + + +STM +--------------------------- + +* Software Transactional Memory + +* "Remove the GIL" + +* But also, new models (better than threads) + +* demo + + +Calling C +--------- + +.. image:: standards.png + :scale: 60% + :align: center + +Calling C landscape +------------------- + +* CPython C extensions + +* SWIG, SIP, wrapper generators + +* ctypes + +* Cython + +* CFFI (our new thing) + +CFFI +---------- + +|scriptsize| +|example<| Example |>| + + .. sourcecode:: pycon + + >>> from cffi import FFI + >>> ffi = FFI() + >>> ffi.cdef(""" + ... int printf(const char *format, ...); + ... """) + >>> C = ffi.dlopen(None) + >>> arg = ffi.new("char[]", "world") + >>> C.printf("hi there, %s!\n", arg) + hi there, world! + +|end_example| +|end_scriptsize| + +CFFI +---- + +* Many more examples + +* Including macro calls and most subtleties of C + +* http://cffi.readthedocs.org + + +Conclusion +---------- + +* Try out PyPy on real code + +* http://pypy.org/ + +* Thank you! diff --git a/talk/googlezurich2012/title.latex b/talk/googlezurich2012/title.latex new file mode 100644 --- /dev/null +++ b/talk/googlezurich2012/title.latex @@ -0,0 +1,5 @@ +\begin{titlepage} +\begin{figure}[h] +\includegraphics[width=60px]{../img/py-web-new.png} +\end{figure} +\end{titlepage} diff --git a/talk/stm2012/stmimpl.rst b/talk/stm2012/stmimpl.rst --- a/talk/stm2012/stmimpl.rst +++ b/talk/stm2012/stmimpl.rst @@ -409,11 +409,8 @@ def PossiblyUpdateChain(G, R, R_Container, FieldName): if R != G and Rarely(): - # compress the chain - while G->h_revision != R: - G_next = G->h_revision - G->h_revision = R - G = G_next + # compress the chain one step (cannot compress the whole chain!) + G->h_revision = R # update the original field R_Container->FieldName = R @@ -425,6 +422,12 @@ the modified values. It works because the original and each modified value are all interchangeable as far as correctness goes. +However, note that if the chain is longer than one item, we cannot fix +the whole chain -- we can only fix the first item. The issue is that we +cannot at this point reliably walk the chain again until we reach ``R``, +precisely because *another* thread might be fixing the *same* chain in +such a way that ``R`` is then skipped. + ``Rarely`` uses a thread-local counter to return True only rarely. We do the above update only rarely, rather than always, although it would naively seem that doing the update always is a good idea. The problem _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit