vbench: lightweight performance testing for python
DESCRIPTION
TRANSCRIPT
![Page 1: vbench: lightweight performance testing for Python](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b7a3f34a79592d048b464c/html5/thumbnails/1.jpg)
vbench: lightweight performance testing
Wes McKinney@wesmckinn
PyCon 2012
Sunday, March 11,
![Page 2: vbench: lightweight performance testing for Python](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b7a3f34a79592d048b464c/html5/thumbnails/2.jpg)
Why do we test?
Sunday, March 11,
![Page 3: vbench: lightweight performance testing for Python](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b7a3f34a79592d048b464c/html5/thumbnails/3.jpg)
Freedom from fear
Sunday, March 11,
![Page 4: vbench: lightweight performance testing for Python](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b7a3f34a79592d048b464c/html5/thumbnails/4.jpg)
Testing for performance?
Sunday, March 11,
![Page 5: vbench: lightweight performance testing for Python](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b7a3f34a79592d048b464c/html5/thumbnails/5.jpg)
Who made my code slower???
Sunday, March 11,
![Page 6: vbench: lightweight performance testing for Python](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b7a3f34a79592d048b464c/html5/thumbnails/6.jpg)
Sunday, March 11,
![Page 7: vbench: lightweight performance testing for Python](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b7a3f34a79592d048b464c/html5/thumbnails/7.jpg)
Who made my code slower???
Sunday, March 11,
![Page 8: vbench: lightweight performance testing for Python](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b7a3f34a79592d048b464c/html5/thumbnails/8.jpg)
Me
Sunday, March 11,
![Page 9: vbench: lightweight performance testing for Python](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b7a3f34a79592d048b464c/html5/thumbnails/9.jpg)
speed.pypy.org is a one-off solution
Sunday, March 11,
![Page 10: vbench: lightweight performance testing for Python](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b7a3f34a79592d048b464c/html5/thumbnails/10.jpg)
Stop. Help is near
• GitHub: wesm/vbench
• Integrates with git: runs benchmarks for each revision in your repo
• Persists results locally in SQLite
• Generates graphs using matplotlib
Sunday, March 11,
![Page 11: vbench: lightweight performance testing for Python](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b7a3f34a79592d048b464c/html5/thumbnails/11.jpg)
Catch performance regressions sooner
Sunday, March 11,
![Page 12: vbench: lightweight performance testing for Python](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b7a3f34a79592d048b464c/html5/thumbnails/12.jpg)
Writing vbenchmarkssetup = common_setup + """values = np.concatenate([np.arange(100000), np.random.randn(100000), np.arange(100000)])s = Series(values)"""
stats_rank_average = Benchmark('s.rank()', setup)
setu
p
Sunday, March 11,
![Page 13: vbench: lightweight performance testing for Python](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b7a3f34a79592d048b464c/html5/thumbnails/13.jpg)
Use them in your workflow
In [2]: stats_rank_average.run()Out[2]: {'loops': 10, 'repeat': 3, 'succeeded': True, 'timing': 33.135390281677246, 'units': 'ms'}
Same code as %timeit in IPython
Sunday, March 11,
![Page 14: vbench: lightweight performance testing for Python](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b7a3f34a79592d048b464c/html5/thumbnails/14.jpg)
Get involved
• A useful weekend hack
• git bisect integration
• More version control systems
• Upload results to codespeed instance
• More setup/teardown control
Sunday, March 11,
![Page 15: vbench: lightweight performance testing for Python](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b7a3f34a79592d048b464c/html5/thumbnails/15.jpg)
GitHub: wesm/vbench
@wesmckinn
Sunday, March 11,