Author: Alex Gaynor <alex.gay...@gmail.com> Branch: extradoc Changeset: r3597:7eeb46762fb7 Date: 2011-06-06 10:24 +0200 http://bitbucket.org/pypy/extradoc/changeset/7eeb46762fb7/
Log: Talk for djangocon diff --git a/talk/djangocon.eu2011/Makefile b/talk/djangocon.eu2011/Makefile new file mode 100644 --- /dev/null +++ b/talk/djangocon.eu2011/Makefile @@ -0,0 +1,3 @@ +display: + rst2s5.py --current-slide talk.rst talk.html + chromium-browser talk.html diff --git a/talk/djangocon.eu2011/talk.rst b/talk/djangocon.eu2011/talk.rst new file mode 100644 --- /dev/null +++ b/talk/djangocon.eu2011/talk.rst @@ -0,0 +1,177 @@ +=============== +Django and PyPy +=============== + +Me +-- + + * Django and PyPy core developer + * I like making your code faster + * Working at Quora making their codebase run on PyPy, fast. + +What is Django? +--------------- + +... + +What is PyPy? +------------- + + * An implementation of Python 2.7.1 + * A very fast implementation + * A very compliant implementation + +What is PyPy? (2) +----------------- + + * Python written in Python + * Open source (MIT licensed) + * 8 years old + * Over 150,000 lines of test code (that's more than all of Django) + * A replacement to Psyco + +Fast +---- + + * Faster than CPython on almost every benchmark we have. + * http://speed.pypy.org/ + +World's shortest introduction to JITing +--------------------------------------- + + * Run interpreter + * Find frequently executed loops + * Turn those loops into efficient assembler, by specializing for the types of variables and other things. + +Case studies +------------ + + * Production ready + * Real people are using this to speed up their apps. + +LWN.net +------- + + * Parse the output of ``git log`` and generate data/reports + * CPython: 63 seconds + * PyPy: 21 seconds + +Some guy on IRC +--------------- + + * Query PostgreSQL and generate reports. + * CPython: 2 minutes + * PyPy: 8 seconds + +Why isn't everyone using PyPy? +------------------------------ + + * C extensions + * C-API tightly coupled to CPython implementation details + +Solutions +--------- + + * CPyExt + * Pure Python/``ctypes`` + * Cython (GSOC) + +But web apps are I/O bound... +----------------------------- + + * Eh, maybe they should be, but they often aren't. + +The Wild Wild Web (WWW for short) +--------------------------------- + + * To run a Django site you need a handful of things + * Web server + * Database + * Random other libraries (``PIL``, ``lxml``, etc.) + +Web server +---------- + + * WSGI + * Any pure Python server will do + * I like ``gunicorn``, you can use whatever you like + * *Not* ``mod_wsgi`` + +Database +-------- + + * Use any database you like, so long as there's an adapter for it that works with both Django and PyPy! + +SQLite +------ + * Standard library, just works! + +PostgreSQL +---------- + * RPython ``psycopg2`` compatible lib, requires compiling your own PyPy + * ``pg8000`` and tons of other random libraries, Django doesn't work with them, but if they're pure Python they'll work with other stuff (e.g. SQLAlchemy) + +MySQL +----- + * (various expletives censored) + * Nothing that works with Django ATM + * I'm working on a ``ctypes`` based MySQLdb dropin replacement, hopefully open source soonish. + +Oracle +------ + + * We have an RPython ``cx_Oracle`` + * I know nothing about its status + +Other databases +--------------- + + * There are other databases? + * Uhh, talk to me later? + +Random other libs +----------------- + + * ``PIL`` - works under CPyExt + * ``lxml`` - doesn't work :( + * Others - how should I know? Others isn't very specific. + +Benchmarking! +------------- + + * Lies, damned lies, and statistics! + * And benchmarks + * Ignore them, you need to test *your* app. + * But if you need to convince your boss... + +Django template benchmark +------------------------- + + * Part of the Unladen Swallow benchmark suite + * PyPy 1.5: almost 10x faster than CPython + * PyPy trunk: almost 12x faster + +Rietveld benchmark +------------------ + + * Another part of the Unladen Swallow benchmark suit + * PyPy trunk: about 1.35x faster than CPython + +Tornado web app +--------------- + + * 2x as many requests per second + +PyPy +---- + + * A better platform for developing Python itself + * A faster Python for your apps + +Questions? +---------- + + * http://alexgaynor.net/ + * http://pypy.org/ + * Thank you! + * Dank je wel! _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit