PyPy is your Past, Present, and Future

Author

Intro

  • There are 2 things faster than C
    • Neutrinos
    • Pypy

Story

  • Armin wanted to write a JIT for Python (Psyco)
  • Psyco was the written by Armin.
  • Kind of messing.
  • Generators came along, and not supported
  • 64-bit computers weren’t supported either
  • Started writing Python in Python
  • About 2000x slower than CPython
  • Somethings in the standard library were in python
  • Copied some optimizations over (TimSort)
  • Writing JITs sucked.
  • Writing a JIT generator for arbitrary languages is much simpler than writing a JIT for Python
  • ~2-3 years ago Alex got into Pypy
  • Beat C in str_cmp ~1 month ago
  • http://speed.pypy.org
  • Tries to show example of real time video analysis, mplayer broke.

Numpy

  • Science likes big datasets, use Numpy
  • Numpy is in C
  • Numpy likes speed, so does pypy
  • Started reimplementing Numpy in Pypy

Hotspot Detection

  • Humans are bad at detecting slow downs

  • Pypy has a JITViewer
  • Shows demo fo JITViewer

  • Look into code
    • “I think that’s too many instructions”
    • Optimize code!
  • Shows example of sum(x**3 for x in xrange(10000))

  • JVM Community has good tooling

  • Python could use that too.

Current

  • Usually benchmark against C
  • Experimenting with using C extensions.

Where we’re going

  • Many projects are being migrated
    • Django
  • Porting to Python3

Architecture

  • Because they use a JIT Generator, can improve constantly
  • Speedups in Python3 will improve Python2

GIL

What People Are Doing with Pypy

  • Researchers getting results over lunch, instead of over night.
  • Financial company for market analysis
  • Engineers at CERN

What Pypy Needs from the Community

  • Encourages use of pypy if you are CPU bound
  • Requests for slow code, and they’ll use it in benchmarks
  • Want to make Python the right tool for the job in more places
  • Work on the ecosystem and tools