{ "metadata": { "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "code", "collapsed": false, "input": [ "%load_ext load_style\n", "%load_style talk.css" ], "language": "python", "metadata": { "slideshow": { "slide_type": "-" } }, "outputs": [] }, { "cell_type": "heading", "level": 1, "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "

Performance tools

\n", "\n", "

...Making Python fast...

" ] }, { "cell_type": "heading", "level": 1, "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "Traditional Python performance" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* Python has a number of strikes against it from a performance perspective\n", " - Dynamic typing\n", " - Intepreted\n", " - Extremely general object model\n", "* There is a long history of projects that have sought to make Python fast\n", " - SWIG (call C/C++ from Python)\n", " - f2py (call Fortran from Python)\n", " - ctypes (call shared libraries from Python)\n", " - Boost.Python (call C++ from Python)\n", "\n", " " ] }, { "cell_type": "heading", "level": 1, "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "New tools for performance" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* New breed of tools are emerging\n", " - Just in time (JIT) compilation\n", " - LLVM\n", " - Optimization techniques\n", " - Add static types and type inference to Python\n", "* In this talk:\n", " - Cython\n", " - Numba\n", "* Others\n", " - [Theano](http://deeplearning.net/software/theano/)\n", " - [Parakeet](http://iskandr.github.io/parakeet/)\n", " " ] }, { "cell_type": "heading", "level": 1, "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "Cython" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* Superset of Python that adds explicit static typing\n", "* Can also call C/C++ code\n", "* Compiled into fast C/C++ with autogenerated Python bindings\n", "* Established, robust, stable\n", "* Best solution for wrapping existing C/C++ codes\n", "* Solid support for multidimensional numerical arrays\n", "* Open source, community effort\n", "* The [GitHub project page](https://github.com/cython/cython)" ] }, { "cell_type": "heading", "level": 1, "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "Numba" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* Start with regular Python code\n", "* Parses the Python code into its abstract syntax tree (AST)\n", "* Static typing and type inference\n", "* Uses LLVM to JIT compile directly into machine code\n", "* New, but gaining momentum\n", "* Solid support for multidimensional numerical arrays\n", "* The [GitHub project page](https://github.com/numba/numba)\n", "* Open source, developed primarily by [Continuum Analytics](http://www.continuum.io/)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "

Performance benchmarks!

" ] } ], "metadata": {} } ] }