forked from pandas-dev/pandas
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmiscellaneous.py
34 lines (25 loc) · 863 Bytes
/
miscellaneous.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
from vbench.benchmark import Benchmark
from datetime import datetime
common_setup = """from pandas_vb_common import *
"""
#----------------------------------------------------------------------
# cache_readonly
setup = common_setup + """
from pandas.util.decorators import cache_readonly
class Foo:
@cache_readonly
def prop(self):
return 5
obj = Foo()
"""
misc_cache_readonly = Benchmark("obj.prop", setup, name="misc_cache_readonly",
ncalls=2000000)
#----------------------------------------------------------------------
# match
setup = common_setup + """
from pandas.util.testing import rands
uniques = np.array([rands(10) for _ in xrange(1000)], dtype='O')
all = uniques.repeat(10)
"""
match_strings = Benchmark("match(all, uniques)", setup,
start_date=datetime(2012, 5, 12))