Skip to content

Commit 35c7af4

Browse files
committed
Move AddOverflow to binary_ops
1 parent d9237c9 commit 35c7af4

File tree

2 files changed

+44
-44
lines changed

2 files changed

+44
-44
lines changed

asv_bench/benchmarks/algorithms.py

-44
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import numpy as np
44
import pandas as pd
55
from pandas.util import testing as tm
6-
from pandas.core.algorithms import checked_add_with_arr
76

87
for imp in ['pandas.util', 'pandas.tools.hashing']:
98
try:
@@ -88,49 +87,6 @@ def time_match_string(self):
8887
pd.match(self.all, self.uniques)
8988

9089

91-
class AddOverflowScalar(object):
92-
93-
goal_time = 0.2
94-
95-
params = [1, -1, 0]
96-
param_names = ['scalar']
97-
98-
def setup(self, scalar):
99-
N = 10**6
100-
self.arr = np.arange(N)
101-
102-
def time_add_overflow_scalar(self, scalar):
103-
checked_add_with_arr(self.arr, scalar)
104-
105-
106-
class AddOverflowArray(object):
107-
108-
goal_time = 0.2
109-
110-
def setup(self):
111-
np.random.seed(1234)
112-
N = 10**6
113-
self.arr = np.arange(N)
114-
self.arr_rev = np.arange(-N, 0)
115-
self.arr_mixed = np.array([1, -1]).repeat(N / 2)
116-
self.arr_nan_1 = np.random.choice([True, False], size=N)
117-
self.arr_nan_2 = np.random.choice([True, False], size=N)
118-
119-
def time_add_overflow_arr_rev(self):
120-
checked_add_with_arr(self.arr, self.arr_rev)
121-
122-
def time_add_overflow_arr_mask_nan(self):
123-
checked_add_with_arr(self.arr, self.arr_mixed, arr_mask=self.arr_nan_1)
124-
125-
def time_add_overflow_b_mask_nan(self):
126-
checked_add_with_arr(self.arr, self.arr_mixed,
127-
b_mask=self.arr_nan_1)
128-
129-
def time_add_overflow_both_arg_nan(self):
130-
checked_add_with_arr(self.arr, self.arr_mixed, arr_mask=self.arr_nan_1,
131-
b_mask=self.arr_nan_2)
132-
133-
13490
class Hashing(object):
13591

13692
goal_time = 0.2

asv_bench/benchmarks/binary_ops.py

+44
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import numpy as np
22
from pandas import DataFrame, Series, date_range
3+
from pandas.core.algorithms import checked_add_with_arr
34
try:
45
import pandas.core.computation.expressions as expr
56
except ImportError:
@@ -108,3 +109,46 @@ def time_timestamp_ops_diff(self, tz):
108109

109110
def time_timestamp_ops_diff_with_shift(self, tz):
110111
self.s - self.s.shift()
112+
113+
114+
class AddOverflowScalar(object):
115+
116+
goal_time = 0.2
117+
118+
params = [1, -1, 0]
119+
param_names = ['scalar']
120+
121+
def setup(self, scalar):
122+
N = 10**6
123+
self.arr = np.arange(N)
124+
125+
def time_add_overflow_scalar(self, scalar):
126+
checked_add_with_arr(self.arr, scalar)
127+
128+
129+
class AddOverflowArray(object):
130+
131+
goal_time = 0.2
132+
133+
def setup(self):
134+
np.random.seed(1234)
135+
N = 10**6
136+
self.arr = np.arange(N)
137+
self.arr_rev = np.arange(-N, 0)
138+
self.arr_mixed = np.array([1, -1]).repeat(N / 2)
139+
self.arr_nan_1 = np.random.choice([True, False], size=N)
140+
self.arr_nan_2 = np.random.choice([True, False], size=N)
141+
142+
def time_add_overflow_arr_rev(self):
143+
checked_add_with_arr(self.arr, self.arr_rev)
144+
145+
def time_add_overflow_arr_mask_nan(self):
146+
checked_add_with_arr(self.arr, self.arr_mixed, arr_mask=self.arr_nan_1)
147+
148+
def time_add_overflow_b_mask_nan(self):
149+
checked_add_with_arr(self.arr, self.arr_mixed,
150+
b_mask=self.arr_nan_1)
151+
152+
def time_add_overflow_both_arg_nan(self):
153+
checked_add_with_arr(self.arr, self.arr_mixed, arr_mask=self.arr_nan_1,
154+
b_mask=self.arr_nan_2)

0 commit comments

Comments
 (0)