vbench: lightweight performance testing for Python

15
vbench: lightweight performance testing Wes McKinney @wesmckinn PyCon 2012 Sunday, March 11,

description

 

Transcript of vbench: lightweight performance testing for Python

Page 1: vbench: lightweight performance testing for Python

vbench: lightweight performance testing

Wes McKinney@wesmckinn

PyCon 2012

Sunday, March 11,

Page 2: vbench: lightweight performance testing for Python

Why do we test?

Sunday, March 11,

Page 3: vbench: lightweight performance testing for Python

Freedom from fear

Sunday, March 11,

Page 4: vbench: lightweight performance testing for Python

Testing for performance?

Sunday, March 11,

Page 5: vbench: lightweight performance testing for Python

Who made my code slower???

Sunday, March 11,

Page 6: vbench: lightweight performance testing for Python

Sunday, March 11,

Page 7: vbench: lightweight performance testing for Python

Who made my code slower???

Sunday, March 11,

Page 8: vbench: lightweight performance testing for Python

Me

Sunday, March 11,

Page 9: vbench: lightweight performance testing for Python

speed.pypy.org is a one-off solution

Sunday, March 11,

Page 10: vbench: lightweight performance testing for Python

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

Catch performance regressions sooner

Sunday, March 11,

Page 12: vbench: lightweight performance testing for Python

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

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

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

GitHub: wesm/vbench

@wesmckinn

Sunday, March 11,