Skip to content

Commit 3a21237

Browse files
committed
PERF: add asv benchmarks for uncovered string methods
1 parent b46a62b commit 3a21237

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

asv_bench/benchmarks/strings.py

+30
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,42 @@ 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

3238
def time_len(self):
3339
self.s.str.len()
3440

41+
def time_join(self):
42+
self.s.str.join(' ')
43+
3544
def time_match(self):
3645
self.s.str.match('A')
3746

47+
def time_normalize(self):
48+
self.s.str.normalize('NFC')
49+
3850
def time_pad(self):
3951
self.s.str.pad(100, side='both')
4052

53+
def time_partition(self):
54+
self.s.str.partition('A')
55+
56+
def time_rpartition(self):
57+
self.s.str.rpartition('A')
58+
4159
def time_replace(self):
4260
self.s.str.replace('A', '\x01\x01')
4361

62+
def time_translate(self):
63+
self.s.str.translate({'A': '\x01\x01'})
64+
4465
def time_slice(self):
4566
self.s.str.slice(5, 15, 2)
4667

@@ -65,6 +86,12 @@ def time_upper(self):
6586
def time_lower(self):
6687
self.s.str.lower()
6788

89+
def time_wrap(self):
90+
self.s.str.wrap(10)
91+
92+
def time_zfill(self):
93+
self.s.str.zfill(10)
94+
6895

6996
class Repeat(object):
7097

@@ -129,6 +156,9 @@ def setup(self, expand):
129156
def time_split(self, expand):
130157
self.s.str.split('--', expand=expand)
131158

159+
def time_rsplit(self, expand):
160+
self.s.str.rsplit('--', expand=expand)
161+
132162

133163
class Dummies(object):
134164

0 commit comments

Comments
 (0)