Skip to content

Commit 2887ba7

Browse files
committed
PERF: add asv benchmarks for uncovered string methods
1 parent 3a202bc commit 2887ba7

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

asv_bench/benchmarks/strings.py

+36
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,48 @@ def time_extract(self):
2626
def time_findall(self):
2727
self.s.str.findall('[A-Z]+')
2828

29+
def time_find(self):
30+
self.s.str.find('[A-Z]+')
31+
32+
def time_rfind(self):
33+
self.s.str.rfind('[A-Z]+')
34+
2935
def time_get(self):
3036
self.s.str.get(0)
3137

38+
def time_index(self):
39+
self.s.str.index('A')
40+
41+
def time_rindex(self):
42+
self.s.str.rindex('A')
43+
3244
def time_len(self):
3345
self.s.str.len()
3446

47+
def time_join(self):
48+
self.s.str.join(' ')
49+
3550
def time_match(self):
3651
self.s.str.match('A')
3752

53+
def time_normalize(self):
54+
self.s.str.normalize('NFC')
55+
3856
def time_pad(self):
3957
self.s.str.pad(100, side='both')
4058

59+
def time_partition(self):
60+
self.s.str.partition('A')
61+
62+
def time_rpartition(self):
63+
self.s.str.rpartition('A')
64+
4165
def time_replace(self):
4266
self.s.str.replace('A', '\x01\x01')
4367

68+
def time_translate(self):
69+
self.s.str.translate({'A': '\x01\x01'})
70+
4471
def time_slice(self):
4572
self.s.str.slice(5, 15, 2)
4673

@@ -65,6 +92,12 @@ def time_upper(self):
6592
def time_lower(self):
6693
self.s.str.lower()
6794

95+
def time_wrap(self):
96+
self.s.str.wrap(10)
97+
98+
def time_zfill(self):
99+
self.s.str.zfill(10)
100+
68101

69102
class Repeat(object):
70103

@@ -129,6 +162,9 @@ def setup(self, expand):
129162
def time_split(self, expand):
130163
self.s.str.split('--', expand=expand)
131164

165+
def time_rsplit(self, expand):
166+
self.s.str.rsplit('--', expand=expand)
167+
132168

133169
class Dummies(object):
134170

0 commit comments

Comments
 (0)