Successfully reported this slideshow.

More Related Content

Related Books

Free with a 14 day trial from Scribd

See all

vbench: lightweight performance testing for Python

  1. 1. vbench: lightweight performance testing Wes McKinney @wesmckinn PyCon 2012 Sunday, March 11,
  2. 2. Why do we test? Sunday, March 11,
  3. 3. Freedom from fear Sunday, March 11,
  4. 4. Testing for performance? Sunday, March 11,
  5. 5. Who made my code slower??? Sunday, March 11,
  6. 6. Sunday, March 11,
  7. 7. Who made my code slower??? Sunday, March 11,
  8. 8. Me Sunday, March 11,
  9. 9. speed.pypy.org is a one-off solution Sunday, March 11,
  10. 10. 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,
  11. 11. Catch performance regressions sooner Sunday, March 11,
  12. 12. Writing vbenchmarks setup = common_setup + """ setup values = np.concatenate([np.arange(100000), np.random.randn(100000), np.arange(100000)]) s = Series(values) """ stats_rank_average = Benchmark('s.rank()', setup) Sunday, March 11,
  13. 13. 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,
  14. 14. 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,
  15. 15. GitHub: wesm/vbench @wesmckinn Sunday, March 11,

×