forked from pandas-dev/pandas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbinary_ops.py
105 lines (88 loc) · 3.28 KB
/
binary_ops.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
from vbench.benchmark import Benchmark
from datetime import datetime
common_setup = """from pandas_vb_common import *
"""
SECTION = 'Binary ops'
#----------------------------------------------------------------------
# binary ops
#----------------------------------------------------------------------
# add
setup = common_setup + """
df = DataFrame(np.random.randn(100000, 100))
df2 = DataFrame(np.random.randn(100000, 100))
"""
frame_add = \
Benchmark("df + df2", setup, name='frame_add',
start_date=datetime(2012, 1, 1))
setup = common_setup + """
import pandas.core.expressions as expr
df = DataFrame(np.random.randn(100000, 100))
df2 = DataFrame(np.random.randn(100000, 100))
expr.set_numexpr_threads(1)
"""
frame_add_st = \
Benchmark("df + df2", setup, name='frame_add_st',cleanup="expr.set_numexpr_threads()",
start_date=datetime(2012, 1, 1))
setup = common_setup + """
import pandas.core.expressions as expr
df = DataFrame(np.random.randn(100000, 100))
df2 = DataFrame(np.random.randn(100000, 100))
expr.set_use_numexpr(False)
"""
frame_add_no_ne = \
Benchmark("df + df2", setup, name='frame_add_no_ne',cleanup="expr.set_use_numexpr(True)",
start_date=datetime(2012, 1, 1))
#----------------------------------------------------------------------
# mult
setup = common_setup + """
df = DataFrame(np.random.randn(100000, 100))
df2 = DataFrame(np.random.randn(100000, 100))
"""
frame_mult = \
Benchmark("df * df2", setup, name='frame_mult',
start_date=datetime(2012, 1, 1))
setup = common_setup + """
import pandas.core.expressions as expr
df = DataFrame(np.random.randn(100000, 100))
df2 = DataFrame(np.random.randn(100000, 100))
expr.set_numexpr_threads(1)
"""
frame_mult_st = \
Benchmark("df * df2", setup, name='frame_mult_st',cleanup="expr.set_numexpr_threads()",
start_date=datetime(2012, 1, 1))
setup = common_setup + """
import pandas.core.expressions as expr
df = DataFrame(np.random.randn(100000, 100))
df2 = DataFrame(np.random.randn(100000, 100))
expr.set_use_numexpr(False)
"""
frame_mult_no_ne = \
Benchmark("df * df2", setup, name='frame_mult_no_ne',cleanup="expr.set_use_numexpr(True)",
start_date=datetime(2012, 1, 1))
#----------------------------------------------------------------------
# multi and
setup = common_setup + """
df = DataFrame(np.random.randn(100000, 100))
df2 = DataFrame(np.random.randn(100000, 100))
"""
frame_multi_and = \
Benchmark("df[(df>0) & (df2>0)]", setup, name='frame_multi_and',
start_date=datetime(2012, 1, 1))
setup = common_setup + """
import pandas.core.expressions as expr
df = DataFrame(np.random.randn(100000, 100))
df2 = DataFrame(np.random.randn(100000, 100))
expr.set_numexpr_threads(1)
"""
frame_multi_and_st = \
Benchmark("df[(df>0) & (df2>0)]", setup, name='frame_multi_and_st',cleanup="expr.set_numexpr_threads()",
start_date=datetime(2012, 1, 1))
setup = common_setup + """
import pandas.core.expressions as expr
df = DataFrame(np.random.randn(100000, 100))
df2 = DataFrame(np.random.randn(100000, 100))
expr.set_use_numexpr(False)
"""
frame_multi_and_no_ne = \
Benchmark("df[(df>0) & (df2>0)]", setup, name='frame_multi_and_no_ne',cleanup="expr.set_use_numexpr(True)",
start_date=datetime(2012, 1, 1))