forked from pandas-dev/pandas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheval.py
114 lines (91 loc) · 4.13 KB
/
eval.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
105
106
107
108
109
110
111
112
113
114
from vbench.benchmark import Benchmark
from datetime import datetime
common_setup = """from pandas_vb_common import *
import pandas as pd
df = DataFrame(np.random.randn(20000, 100))
df2 = DataFrame(np.random.randn(20000, 100))
df3 = DataFrame(np.random.randn(20000, 100))
df4 = DataFrame(np.random.randn(20000, 100))
"""
setup = common_setup + """
import pandas.computation.expressions as expr
expr.set_numexpr_threads(1)
"""
SECTION = 'Eval'
#----------------------------------------------------------------------
# binary ops
#----------------------------------------------------------------------
# add
eval_frame_add_all_threads = \
Benchmark("pd.eval('df + df2 + df3 + df4')", common_setup,
name='eval_frame_add_all_threads',
start_date=datetime(2013, 7, 21))
eval_frame_add_one_thread = \
Benchmark("pd.eval('df + df2 + df3 + df4')", setup,
name='eval_frame_add_one_thread',
start_date=datetime(2013, 7, 26))
eval_frame_add_python = \
Benchmark("pd.eval('df + df2 + df3 + df4', engine='python')", common_setup,
name='eval_frame_add_python', start_date=datetime(2013, 7, 21))
eval_frame_add_python_one_thread = \
Benchmark("pd.eval('df + df2 + df3 + df4', engine='python')", setup,
name='eval_frame_add_python_one_thread',
start_date=datetime(2013, 7, 26))
#----------------------------------------------------------------------
# mult
eval_frame_mult_all_threads = \
Benchmark("pd.eval('df * df2 * df3 * df4')", common_setup,
name='eval_frame_mult_all_threads',
start_date=datetime(2012, 7, 21))
eval_frame_mult_one_thread = \
Benchmark("pd.eval('df * df2 * df3 * df4')", setup,
name='eval_frame_mult_one_thread',
start_date=datetime(2012, 7, 26))
eval_frame_mult_python = \
Benchmark("pdl.eval('df * df2 * df3 * df4', engine='python')",
common_setup,
name='eval_frame_mult_python', start_date=datetime(2013, 7, 21))
eval_frame_mult_python_one_thread = \
Benchmark("pd.eval('df * df2 * df3 * df4', engine='python')", setup,
name='eval_frame_mult_python_one_thread',
start_date=datetime(2012, 7, 26))
#----------------------------------------------------------------------
# multi and
eval_frame_and_all_threads = \
Benchmark("pd.eval('(df > 0) & (df2 > 0) & (df3 > 0) & (df4 > 0)')",
common_setup,
name='eval_frame_and_all_threads',
start_date=datetime(2012, 7, 21))
eval_frame_and_one_thread = \
Benchmark("pd.eval('(df > 0) & (df2 > 0) & (df3 > 0) & (df4 > 0)')", setup,
name='eval_frame_and_one_thread',
start_date=datetime(2012, 7, 26))
setup = common_setup
eval_frame_and_python = \
Benchmark("pd.eval('(df > 0) & (df2 > 0) & (df3 > 0) & (df4 > 0)', engine='python')",
common_setup, name='eval_frame_and_python',
start_date=datetime(2013, 7, 21))
eval_frame_and_one_thread = \
Benchmark("pd.eval('(df > 0) & (df2 > 0) & (df3 > 0) & (df4 > 0)', engine='python')",
setup,
name='eval_frame_and_python_one_thread',
start_date=datetime(2012, 7, 26))
#--------------------------------------------------------------------
# chained comp
eval_frame_chained_cmp_all_threads = \
Benchmark("pd.eval('df < df2 < df3 < df4')", common_setup,
name='eval_frame_chained_cmp_all_threads',
start_date=datetime(2012, 7, 21))
eval_frame_chained_cmp_one_thread = \
Benchmark("pd.eval('df < df2 < df3 < df4')", setup,
name='eval_frame_chained_cmp_one_thread',
start_date=datetime(2012, 7, 26))
setup = common_setup
eval_frame_chained_cmp_python = \
Benchmark("pd.eval('df < df2 < df3 < df4', engine='python')",
common_setup, name='eval_frame_chained_cmp_python',
start_date=datetime(2013, 7, 26))
eval_frame_chained_cmp_one_thread = \
Benchmark("pd.eval('df < df2 < df3 < df4', engine='python')", setup,
name='eval_frame_chained_cmp_python_one_thread',
start_date=datetime(2012, 7, 26))