Skip to content

Commit a1bf2c8

Browse files
committed
CI: Run ASV on Travis for failed benchmarks
create asv.sh add to travis Changed file permission Add else statement and asv machine config move to separate travis build CI: Run ASV on Travis for failed benchmarks create asv.sh add to travis move to separate travis build Change build order and change to asv dev Put asv before doc Fix some failing benchmarks Grep for failed benchmarks Add travis wait Don't grep output yet Remove travis_wait for now fix some benchmarks Now grep output add travis wait 40 to ci/asv.sh Add tee Remove wait Start catching warnings catch more warnings Fix ci strategy Remove rolling_* from gil.py catch more warnings
1 parent 69cd5fb commit a1bf2c8

22 files changed

+187
-80
lines changed

.travis.yml

+8
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ matrix:
7373
env:
7474
- JOB="3.6_NUMPY_DEV" TEST_ARGS="--skip-slow --skip-network" PANDAS_TESTING_MODE="deprecate"
7575
# In allow_failures
76+
- dist: trusty
77+
env:
78+
- JOB="3.6_ASV" ASV=true
79+
# In allow_failures
7680
- dist: trusty
7781
env:
7882
- JOB="3.6_DOC" DOC=true
@@ -93,6 +97,9 @@ matrix:
9397
- dist: trusty
9498
env:
9599
- JOB="3.6_NUMPY_DEV" TEST_ARGS="--skip-slow --skip-network" PANDAS_TESTING_MODE="deprecate"
100+
- dist: trusty
101+
env:
102+
- JOB="3.6_ASV" ASV=true
96103
- dist: trusty
97104
env:
98105
- JOB="3.6_DOC" DOC=true
@@ -128,6 +135,7 @@ script:
128135
- ci/script_single.sh
129136
- ci/script_multi.sh
130137
- ci/lint.sh
138+
- ci/asv.sh
131139
- echo "checking imports"
132140
- source activate pandas && python ci/check_imports.py
133141
- echo "script done"

asv_bench/benchmarks/algorithms.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import warnings
12
from importlib import import_module
23

34
import numpy as np
@@ -83,7 +84,8 @@ def setup(self):
8384
self.all = self.uniques.repeat(10)
8485

8586
def time_match_string(self):
86-
pd.match(self.all, self.uniques)
87+
with warnings.catch_warnings(record=True):
88+
pd.match(self.all, self.uniques)
8789

8890

8991
class Hashing(object):

asv_bench/benchmarks/categoricals.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import warnings
2+
13
import numpy as np
24
import pandas as pd
35
import pandas.util.testing as tm
@@ -119,11 +121,15 @@ def setup(self):
119121

120122
self.s_str = pd.Series(tm.makeCategoricalIndex(N, ncats)).astype(str)
121123
self.s_str_cat = self.s_str.astype('category')
122-
self.s_str_cat_ordered = self.s_str.astype('category', ordered=True)
124+
with warnings.catch_warnings(record=True):
125+
self.s_str_cat_ordered = self.s_str.astype('category',
126+
ordered=True)
123127

124128
self.s_int = pd.Series(np.random.randint(0, ncats, size=N))
125129
self.s_int_cat = self.s_int.astype('category')
126-
self.s_int_cat_ordered = self.s_int.astype('category', ordered=True)
130+
with warnings.catch_warnings(record=True):
131+
self.s_int_cat_ordered = self.s_int.astype('category',
132+
ordered=True)
127133

128134
def time_rank_string(self):
129135
self.s_str.rank()

asv_bench/benchmarks/frame_methods.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import string
2+
import warnings
3+
24
import numpy as np
35
import pandas.util.testing as tm
46
from pandas import (DataFrame, Series, MultiIndex, date_range, period_range,
@@ -15,7 +17,8 @@ def setup(self):
1517
self.df = DataFrame(np.random.randn(10000, 25))
1618
self.df['foo'] = 'bar'
1719
self.df['bar'] = 'baz'
18-
self.df = self.df.consolidate()
20+
with warnings.catch_warnings(record=True):
21+
self.df = self.df.consolidate()
1922

2023
def time_frame_get_numeric_data(self):
2124
self.df._get_numeric_data()
@@ -141,8 +144,8 @@ class Repr(object):
141144
def setup(self):
142145
nrows = 10000
143146
data = np.random.randn(nrows, 10)
144-
idx = MultiIndex.from_arrays(np.tile(np.random.randn(3, nrows / 100),
145-
100))
147+
arrays = np.tile(np.random.randn(3, int(nrows / 100)), 100)
148+
idx = MultiIndex.from_arrays(arrays)
146149
self.df3 = DataFrame(data, index=idx)
147150
self.df4 = DataFrame(data, index=np.random.randn(nrows))
148151
self.df_tall = DataFrame(np.random.randn(nrows, 10))

asv_bench/benchmarks/gil.py

+8-34
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import numpy as np
22
import pandas.util.testing as tm
3-
from pandas import (DataFrame, Series, rolling_median, rolling_mean,
4-
rolling_min, rolling_max, rolling_var, rolling_skew,
5-
rolling_kurt, rolling_std, read_csv, factorize, date_range)
3+
from pandas import DataFrame, Series, read_csv, factorize, date_range
64
from pandas.core.algorithms import take_1d
75
try:
86
from pandas._libs import algos
@@ -171,44 +169,20 @@ def run(period):
171169
class ParallelRolling(object):
172170

173171
goal_time = 0.2
174-
params = ['rolling_median', 'rolling_mean', 'rolling_min', 'rolling_max',
175-
'rolling_var', 'rolling_skew', 'rolling_kurt', 'rolling_std']
172+
params = ['median', 'mean', 'min', 'max', 'var', 'skew', 'kurt', 'std']
176173
param_names = ['method']
177174

178175
def setup(self, method):
179176
if not have_real_test_parallel:
180177
raise NotImplementedError
181178
win = 100
182179
arr = np.random.rand(100000)
183-
if hasattr(DataFrame, 'rolling'):
184-
rolling = {'rolling_median': 'median',
185-
'rolling_mean': 'mean',
186-
'rolling_min': 'min',
187-
'rolling_max': 'max',
188-
'rolling_var': 'var',
189-
'rolling_skew': 'skew',
190-
'rolling_kurt': 'kurt',
191-
'rolling_std': 'std'}
192-
df = DataFrame(arr).rolling(win)
193-
194-
@test_parallel(num_threads=2)
195-
def parallel_rolling():
196-
getattr(df, rolling[method])()
197-
self.parallel_rolling = parallel_rolling
198-
else:
199-
rolling = {'rolling_median': rolling_median,
200-
'rolling_mean': rolling_mean,
201-
'rolling_min': rolling_min,
202-
'rolling_max': rolling_max,
203-
'rolling_var': rolling_var,
204-
'rolling_skew': rolling_skew,
205-
'rolling_kurt': rolling_kurt,
206-
'rolling_std': rolling_std}
207-
208-
@test_parallel(num_threads=2)
209-
def parallel_rolling():
210-
rolling[method](arr, win)
211-
self.parallel_rolling = parallel_rolling
180+
df = DataFrame(arr).rolling(win)
181+
182+
@test_parallel(num_threads=2)
183+
def parallel_rolling():
184+
getattr(df, method)()
185+
self.parallel_rolling = parallel_rolling
212186

213187
def time_rolling(self, method):
214188
self.parallel_rolling()

asv_bench/benchmarks/groupby.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import warnings
12
from string import ascii_letters
23
from itertools import product
34
from functools import partial
@@ -340,7 +341,8 @@ def time_dt_size(self):
340341
self.df.groupby(['dates']).size()
341342

342343
def time_dt_timegrouper_size(self):
343-
self.df.groupby(TimeGrouper(key='dates', freq='M')).size()
344+
with warnings.catch_warnings(record=True):
345+
self.df.groupby(TimeGrouper(key='dates', freq='M')).size()
344346

345347
def time_category_size(self):
346348
self.draws.groupby(self.cats).size()
@@ -467,7 +469,7 @@ class SumMultiLevel(object):
467469

468470
def setup(self):
469471
N = 50
470-
self.df = DataFrame({'A': range(N) * 2,
472+
self.df = DataFrame({'A': list(range(N)) * 2,
471473
'B': range(N * 2),
472474
'C': 1}).set_index(['A', 'B'])
473475

asv_bench/benchmarks/indexing.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import warnings
2+
13
import numpy as np
24
import pandas.util.testing as tm
35
from pandas import (Series, DataFrame, MultiIndex, Int64Index, Float64Index,
@@ -91,7 +93,8 @@ def time_getitem_pos_slice(self, index):
9193
self.s[:80000]
9294

9395
def time_get_value(self, index):
94-
self.s.get_value(self.lbl)
96+
with warnings.catch_warnings(record=True):
97+
self.s.get_value(self.lbl)
9598

9699
def time_getitem_scalar(self, index):
97100
self.s[self.lbl]
@@ -112,7 +115,8 @@ def setup(self):
112115
self.bool_obj_indexer = self.bool_indexer.astype(object)
113116

114117
def time_get_value(self):
115-
self.df.get_value(self.idx_scalar, self.col_scalar)
118+
with warnings.catch_warnings(record=True):
119+
self.df.get_value(self.idx_scalar, self.col_scalar)
116120

117121
def time_ix(self):
118122
self.df.ix[self.idx_scalar, self.col_scalar]
@@ -231,11 +235,13 @@ class PanelIndexing(object):
231235
goal_time = 0.2
232236

233237
def setup(self):
234-
self.p = Panel(np.random.randn(100, 100, 100))
235-
self.inds = range(0, 100, 10)
238+
with warnings.catch_warnings(record=True):
239+
self.p = Panel(np.random.randn(100, 100, 100))
240+
self.inds = range(0, 100, 10)
236241

237242
def time_subset(self):
238-
self.p.ix[(self.inds, self.inds, self.inds)]
243+
with warnings.catch_warnings(record=True):
244+
self.p.ix[(self.inds, self.inds, self.inds)]
239245

240246

241247
class MethodLookup(object):
@@ -295,7 +301,8 @@ def setup(self):
295301
def time_insert(self):
296302
np.random.seed(1234)
297303
for i in range(100):
298-
self.df.insert(0, i, np.random.randn(self.N))
304+
self.df.insert(0, i, np.random.randn(self.N),
305+
allow_duplicates=True)
299306

300307
def time_assign_with_setitem(self):
301308
np.random.seed(1234)

asv_bench/benchmarks/io/hdf.py

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import warnings
2+
13
import numpy as np
24
from pandas import DataFrame, Panel, date_range, HDFStore, read_hdf
35
import pandas.util.testing as tm
@@ -105,22 +107,25 @@ class HDFStorePanel(BaseIO):
105107

106108
def setup(self):
107109
self.fname = '__test__.h5'
108-
self.p = Panel(np.random.randn(20, 1000, 25),
109-
items=['Item%03d' % i for i in range(20)],
110-
major_axis=date_range('1/1/2000', periods=1000),
111-
minor_axis=['E%03d' % i for i in range(25)])
112-
self.store = HDFStore(self.fname)
113-
self.store.append('p1', self.p)
110+
with warnings.catch_warnings(record=True):
111+
self.p = Panel(np.random.randn(20, 1000, 25),
112+
items=['Item%03d' % i for i in range(20)],
113+
major_axis=date_range('1/1/2000', periods=1000),
114+
minor_axis=['E%03d' % i for i in range(25)])
115+
self.store = HDFStore(self.fname)
116+
self.store.append('p1', self.p)
114117

115118
def teardown(self):
116119
self.store.close()
117120
self.remove(self.fname)
118121

119122
def time_read_store_table_panel(self):
120-
self.store.select('p1')
123+
with warnings.catch_warnings(record=True):
124+
self.store.select('p1')
121125

122126
def time_write_store_table_panel(self):
123-
self.store.append('p2', self.p)
127+
with warnings.catch_warnings(record=True):
128+
self.store.append('p2', self.p)
124129

125130

126131
class HDF(BaseIO):

asv_bench/benchmarks/join_merge.py

+16-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import warnings
12
import string
23

34
import numpy as np
@@ -26,7 +27,8 @@ def setup(self):
2627
self.mdf1['obj2'] = 'bar'
2728
self.mdf1['int1'] = 5
2829
try:
29-
self.mdf1.consolidate(inplace=True)
30+
with warnings.catch_warnings(record=True):
31+
self.mdf1.consolidate(inplace=True)
3032
except:
3133
pass
3234
self.mdf2 = self.mdf1.copy()
@@ -75,16 +77,23 @@ class ConcatPanels(object):
7577
param_names = ['axis', 'ignore_index']
7678

7779
def setup(self, axis, ignore_index):
78-
panel_c = Panel(np.zeros((10000, 200, 2), dtype=np.float32, order='C'))
79-
self.panels_c = [panel_c] * 20
80-
panel_f = Panel(np.zeros((10000, 200, 2), dtype=np.float32, order='F'))
81-
self.panels_f = [panel_f] * 20
80+
with warnings.catch_warnings(record=True):
81+
panel_c = Panel(np.zeros((10000, 200, 2),
82+
dtype=np.float32,
83+
order='C'))
84+
self.panels_c = [panel_c] * 20
85+
panel_f = Panel(np.zeros((10000, 200, 2),
86+
dtype=np.float32,
87+
order='F'))
88+
self.panels_f = [panel_f] * 20
8289

8390
def time_c_ordered(self, axis, ignore_index):
84-
concat(self.panels_c, axis=axis, ignore_index=ignore_index)
91+
with warnings.catch_warnings(record=True):
92+
concat(self.panels_c, axis=axis, ignore_index=ignore_index)
8593

8694
def time_f_ordered(self, axis, ignore_index):
87-
concat(self.panels_f, axis=axis, ignore_index=ignore_index)
95+
with warnings.catch_warnings(record=True):
96+
concat(self.panels_f, axis=axis, ignore_index=ignore_index)
8897

8998

9099
class ConcatDataFrames(object):

asv_bench/benchmarks/offset.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- coding: utf-8 -*-
2+
import warnings
23
from datetime import datetime
34

45
import numpy as np
@@ -76,7 +77,8 @@ def setup(self, offset):
7677
self.data = pd.Series(rng)
7778

7879
def time_add_offset(self, offset):
79-
self.data + offset
80+
with warnings.catch_warnings(record=True):
81+
self.data + offset
8082

8183

8284
class OffsetDatetimeIndexArithmetic(object):
@@ -90,7 +92,8 @@ def setup(self, offset):
9092
self.data = pd.date_range(start='1/1/2000', periods=N, freq='T')
9193

9294
def time_add_offset(self, offset):
93-
self.data + offset
95+
with warnings.catch_warnings(record=True):
96+
self.data + offset
9497

9598

9699
class OffestDatetimeArithmetic(object):

asv_bench/benchmarks/panel_ctor.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import warnings
12
from datetime import datetime, timedelta
23

34
from pandas import DataFrame, DatetimeIndex, date_range
@@ -19,7 +20,8 @@ def setup(self):
1920
self.data_frames[x] = df
2021

2122
def time_from_dict(self):
22-
Panel.from_dict(self.data_frames)
23+
with warnings.catch_warnings(record=True):
24+
Panel.from_dict(self.data_frames)
2325

2426

2527
class SameIndexes(object):
@@ -34,7 +36,8 @@ def setup(self):
3436
self.data_frames = dict(enumerate([df] * 100))
3537

3638
def time_from_dict(self):
37-
Panel.from_dict(self.data_frames)
39+
with warnings.catch_warnings(record=True):
40+
Panel.from_dict(self.data_frames)
3841

3942

4043
class TwoIndexes(object):
@@ -53,4 +56,5 @@ def setup(self):
5356
self.data_frames = dict(enumerate(dfs))
5457

5558
def time_from_dict(self):
56-
Panel.from_dict(self.data_frames)
59+
with warnings.catch_warnings(record=True):
60+
Panel.from_dict(self.data_frames)

0 commit comments

Comments
 (0)