Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add asv benchmarks for essential functions #23935

Merged
merged 8 commits into from
Nov 27, 2018
Next Next commit
PERF: add asv benchmarks for uncovered plotting methods
  • Loading branch information
qwhelan committed Nov 27, 2018
commit 57d7a7b45f7b5ec8f0fadf2418fbe1f75725a82c
53 changes: 42 additions & 11 deletions asv_bench/benchmarks/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,48 @@
matplotlib.use('Agg')


class Plotting(object):

def setup(self):
self.s = Series(np.random.randn(1000000))
self.df = DataFrame({'col': self.s})

def time_series_plot(self):
self.s.plot()

def time_frame_plot(self):
self.df.plot()
class SeriesPlotting(object):
params = [['line', 'bar', 'area', 'barh', 'hist', 'kde', 'pie']]
param_names = ['kind']

def setup(self, kind):
if kind in ['bar', 'barh', 'pie']:
n = 100
elif kind in ['kde']:
n = 10000
else:
n = 1000000

self.s = Series(np.random.randn(n))
if kind in ['area', 'pie']:
self.s = self.s.abs()

def time_series_plot(self, kind):
self.s.plot(kind=kind)


class FramePlotting(object):
params = [['line', 'bar', 'area', 'barh', 'hist', 'kde', 'pie', 'scatter',
'hexbin']]
param_names = ['kind']

def setup(self, kind):
if kind in ['bar', 'barh', 'pie']:
n = 100
elif kind in ['kde', 'scatter', 'hexbin']:
n = 10000
else:
n = 1000000

self.x = Series(np.random.randn(n))
self.y = Series(np.random.randn(n))
if kind in ['area', 'pie']:
self.x = self.x.abs()
self.y = self.y.abs()
self.df = DataFrame({'x': self.x, 'y': self.y})

def time_frame_plot(self, kind):
self.df.plot(x='x', y='y', kind=kind)


class TimeseriesPlotting(object):
Expand Down