Skip to content

Commit 691007b

Browse files
committed
[benchmark] LogParser: Accept -?! in bench. names
Extend parser to support benchmark names that include `-?!` in names, to fully support the new Naming Convention from PR #20334.
1 parent 84e7d4d commit 691007b

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

benchmark/scripts/compare_perf_tests.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,9 @@ def _reset(self):
363363
# Parse lines like this
364364
# #,TEST,SAMPLES,MIN(μs),MAX(μs),MEAN(μs),SD(μs),MEDIAN(μs)
365365
results_re = re.compile(
366-
r'( *\d+[, \t]+[\w.]+[, \t]+' + # #,TEST
367-
r'[, \t]+'.join([r'\d+'] * 2) + # at least 2...
368-
r'(?:[, \t]+\d*)*)') # ...or more numeric columns
366+
r'( *\d+[, \t]+[\w.\-\?!]+[, \t]+' + # #,TEST
367+
r'[, \t]+'.join([r'\d+'] * 2) + # at least 2...
368+
r'(?:[, \t]+\d*)*)') # ...or more numeric columns
369369

370370
def _append_result(self, result):
371371
columns = result.split(',') if ',' in result else result.split()

benchmark/scripts/test_compare_perf_tests.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -445,14 +445,20 @@ class TestLogParser(unittest.TestCase):
445445
def test_parse_results_csv(self):
446446
"""Ignores uknown lines, extracts data from supported formats."""
447447
log = """#,TEST,SAMPLES,MIN(us),MAX(us),MEAN(us),SD(us),MEDIAN(us)
448-
34,BitCount,20,3,4,4,0,4
448+
7,Array.append.Array.Int?,20,10,10,10,0,10
449+
21,Bridging.NSArray.as!.Array.NSString,20,11,11,11,0,11
450+
42,Flatten.Array.Tuple4.lazy.for-in.Reserve,20,3,4,4,0,4
449451
450452
Total performance tests executed: 1
451453
"""
452454
parser = LogParser()
453455
results = parser.parse_results(log.splitlines())
454456
self.assertTrue(isinstance(results[0], PerformanceTestResult))
455-
self.assertEqual(results[0].name, 'BitCount')
457+
self.assertEquals(results[0].name, 'Array.append.Array.Int?')
458+
self.assertEquals(results[1].name,
459+
'Bridging.NSArray.as!.Array.NSString')
460+
self.assertEquals(results[2].name,
461+
'Flatten.Array.Tuple4.lazy.for-in.Reserve')
456462

457463
def test_parse_results_tab_delimited(self):
458464
log = '34\tBitCount\t20\t3\t4\t4\t0\t4'

0 commit comments

Comments
 (0)