Author: Antonio Cuni <anto.c...@gmail.com> Branch: extradoc Changeset: r5814:0383fac69aac Date: 2017-07-12 10:50 +0200 http://bitbucket.org/pypy/extradoc/changeset/0383fac69aac/
Log: slides about v4 diff --git a/talk/ep2017/the-joy-of-pypy-jit/bazinga.jpg b/talk/ep2017/the-joy-of-pypy-jit/bazinga.jpg new file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..af860005ed4c9c216800c877ce79653d81e89219 GIT binary patch [cut] diff --git a/talk/ep2017/the-joy-of-pypy-jit/sobel/chart.py b/talk/ep2017/the-joy-of-pypy-jit/sobel/chart.py --- a/talk/ep2017/the-joy-of-pypy-jit/sobel/chart.py +++ b/talk/ep2017/the-joy-of-pypy-jit/sobel/chart.py @@ -1,9 +1,8 @@ import numpy as np import matplotlib.pyplot as plt -N = 5 -CPYTHON = (4.99, 2.85, 1.62, 0.59) -PYPY = (288.67, 278.25, 276.81, 235.91) +CPYTHON = (4.99, 2.85, 1.62, 0.59, 0.33, 0.57) +PYPY = (288.67, 278.25, 276.81, 256.79, 25.31, 244.36) def draw(title, values, allvalues, color): filename = '%s-v%d.png' % (title, len(values)-1) @@ -30,6 +29,5 @@ draw('PyPy', PYPY[:i], PYPY, color='r') draw('CPython', CPYTHON[:i], CPYTHON, color='b') - -## for i, (cpy, pypy) in enumerate(zip(CPYTHON, PYPY)): -## print i, pypy/cpy +for i, (cpy, pypy) in enumerate(zip(CPYTHON, PYPY)): + print i, pypy/cpy diff --git a/talk/ep2017/the-joy-of-pypy-jit/talk.rst b/talk/ep2017/the-joy-of-pypy-jit/talk.rst --- a/talk/ep2017/the-joy-of-pypy-jit/talk.rst +++ b/talk/ep2017/the-joy-of-pypy-jit/talk.rst @@ -322,9 +322,78 @@ |end_columns| -* PyPy is ~400x faster +* PyPy is ~435x faster +Version 4 +---------- + +|tiny| + +.. sourcecode:: python + + class Kernel(object): + + def __init__(self, matrix): + self.height = len(matrix) + self.width = len(matrix[0]) + self.matrix = matrix + + def __call__(self, img, p): + value = 0.0 + for j, row in enumerate(self.matrix, -(self.height/2)): + for i, k in enumerate(row, -(self.width/2)): + value += img[p + (i, j)] * k + return value + + + Gx = Kernel([[-1.0, 0.0, +1.0], + [-2.0, 0.0, +2.0], + [-1.0, 0.0, +1.0]]) + + Gy = Kernel([[-1.0, -2.0, -1.0], + [0.0, 0.0, 0.0], + [+1.0, +2.0, +1.0]]) + + + def sobel(img): + ... + dx = Gx(img, p) + dy = Gy(img, p) + ... + +|end_tiny| + +Version 4 +---------- + +|column1| + +.. image:: sobel/CPython-v4.png + :scale: 30% + +|column2| + +.. image:: sobel/PyPy-v4.png + :scale: 30% + +|end_columns| + +* PyPy massively slower :( + + - (still 76x faster than CPython) + +* I'm a liar + +* PyPy sucks + +Wait +----------------------- + +.. image:: bazinga.jpg + :scale: 30% + :align: center + The cost of abstraction ------------------------ @@ -338,7 +407,7 @@ - abstractions (almost) for free - - v3 is ~20% slower than v0, v1, v2 + - v5 is ~20% slower than v0, v1, v2 PyPy JIT 101 @@ -602,9 +671,9 @@ * "PyPy meets Python 3 and numpy" - - Armin Rigo + - Armin Rigo - - Friday, 14:00 + - Friday, 14:00 * Or, just talk to us :) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit