Author: Antonio Cuni <anto.c...@gmail.com>
Branch: extradoc
Changeset: r5810:be6b6ec88341
Date: 2017-07-11 00:38 +0200
http://bitbucket.org/pypy/extradoc/changeset/be6b6ec88341/

Log:    generate some charts and show them

diff --git a/talk/ep2017/the-joy-of-pypy-jit/Makefile 
b/talk/ep2017/the-joy-of-pypy-jit/Makefile
--- a/talk/ep2017/the-joy-of-pypy-jit/Makefile
+++ b/talk/ep2017/the-joy-of-pypy-jit/Makefile
@@ -4,12 +4,15 @@
 # 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 stylesheet.latex
+talk.pdf: talk.rst author.latex stylesheet.latex sobel/CPython-v0.png
        python `which rst2beamer.py` --stylesheet=stylesheet.latex 
--documentoptions=14pt talk.rst talk.latex || exit
 
        sed 's/\\date{}/\\input{author.latex}/' -i talk.latex || exit
        pdflatex talk.latex  || exit
 
+sobel/CPython-v0.png: sobel/chart.py
+       cd sobel && python chart.py
+
 view: talk.pdf
        evince talk.pdf &
 
diff --git a/talk/ep2017/the-joy-of-pypy-jit/sobel/chart.py 
b/talk/ep2017/the-joy-of-pypy-jit/sobel/chart.py
new file mode 100644
--- /dev/null
+++ b/talk/ep2017/the-joy-of-pypy-jit/sobel/chart.py
@@ -0,0 +1,35 @@
+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)
+
+def draw(title, values, allvalues, color):
+    filename = '%s-v%d.png' % (title, len(values)-1)
+    ylim = max(allvalues) * 1.20
+    labels = ['v%d' % i for i in range(len(values))]
+    extra = len(allvalues) - len(values)
+    values = values + (0,)*extra
+    labels = labels + ['']*extra
+    
+    ind = np.arange(len(values))
+    width = 0.35       # the width of the bars
+
+    fig, ax = plt.subplots()
+    ax.bar(ind, values, width, color=color)
+    ax.set_ylabel('fps')
+    ax.set_title(title + ' FPS')
+    ax.set_xticks(ind + width / 2)
+    ax.set_xticklabels(labels)
+    ax.set_ylim((0, ylim))
+    print filename
+    plt.savefig(filename)
+
+for i in range(1, len(CPYTHON)+1):
+    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
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
@@ -126,14 +126,29 @@
  
 |end_scriptsize|
 
-Version 0, demo
+Version 0
 ---------------
 
 Demo
 
-|pause|
 
-PyPy is ~23x faster. Cool.
+
+Version 0
+----------
+
+|column1|
+
+.. image:: sobel/CPython-v0.png
+   :scale: 30%
+           
+|column2|
+
+.. image:: sobel/PyPy-v0.png
+   :scale: 30%
+           
+|end_columns|
+
+* PyPy is ~59x faster
 
 
 Version 1
@@ -169,6 +184,22 @@
 
 |end_scriptsize|
 
+Version 1
+----------
+
+|column1|
+
+.. image:: sobel/CPython-v1.png
+   :scale: 30%
+           
+|column2|
+
+.. image:: sobel/PyPy-v1.png
+   :scale: 30%
+           
+|end_columns|
+
+* PyPy is ~97x faster
 
 Version 2
 ---------
@@ -197,6 +228,22 @@
 
 |end_scriptsize|
 
+Version 2
+----------
+
+|column1|
+
+.. image:: sobel/CPython-v2.png
+   :scale: 30%
+           
+|column2|
+
+.. image:: sobel/PyPy-v2.png
+   :scale: 30%
+           
+|end_columns|
+
+* PyPy is ~170x faster
 
 Version 3
 -------------
@@ -257,3 +304,21 @@
             out[p] = value
 
 |end_scriptsize|
+
+Version 3
+----------
+
+|column1|
+
+.. image:: sobel/CPython-v3.png
+   :scale: 30%
+           
+|column2|
+
+.. image:: sobel/PyPy-v3.png
+   :scale: 30%
+           
+|end_columns|
+
+* PyPy is ~400x faster
+
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to