Skip to content

Commit e066d45

Browse files
authored
Merge pull request #22726 from palimondo/cells-interlinked
[benchmark] Finish Naming Convention Support
2 parents 0a49ba8 + f4951e9 commit e066d45

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed

benchmark/Naming.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ benchmark is testing individual method on a concrete type.
2828
````
2929
⛔️ Dictionary2
3030
✅ AngryPhonebook
31-
✅ Dictionary.AnyHashable.String.update
3231
✅ Array.append.Array.Int
32+
✅ Dictionary.AnyHashable.String.update
3333
````
3434

3535
Benchmark names are used to run individual tests when passed as command line
@@ -42,8 +42,8 @@ optional chaining etc.
4242

4343
````
4444
✅ Array.append.Array.Int?
45-
✅ Flatten.Array.Tuple4.for-in.reserved
4645
✅ Bridging.NSArray.as!.Array.NSString
46+
✅ Flatten.Array.Tuple4.for-in.Reserve
4747
````
4848

4949
Note: Special characters that could be interpreted by the shell require escaping

benchmark/scripts/Benchmark_Driver

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class BenchmarkDriver(object):
200200
with open(log_file, 'w') as f:
201201
f.write(output)
202202

203-
RESULT = '{:>3} {:<25} {:>7} {:>7} {:>6} {:>10} {:>6} {:>7} {:>10}'
203+
RESULT = '{:>3} {:<40} {:>7} {:>7} {:>6} {:>10} {:>6} {:>7} {:>10}'
204204

205205
def run_and_log(self, csv_console=True):
206206
"""Run benchmarks and continuously log results to the console.

benchmark/scripts/compare_perf_tests.py

Lines changed: 3 additions & 3 deletions
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_Benchmark_Driver.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,10 @@ def mock_run(test):
366366
self.assertEqual(log, header + csv_log)
367367
self.assertEqual(
368368
out.getvalue(),
369-
' # TEST SAMPLES MIN(μs) Q1(μs)' +
370-
' MEDIAN(μs) Q3(μs) MAX(μs) MAX_RSS(B)\n' +
371-
' 3 b1 5 101 102' +
372-
' 103 104 105 888\n' +
369+
' # TEST SAMPLES MIN(μs)' +
370+
' Q1(μs) MEDIAN(μs) Q3(μs) MAX(μs) MAX_RSS(B)\n' +
371+
' 3 b1 5 101' +
372+
' 102 103 104 105 888\n' +
373373
'\n' +
374374
'Total performance tests executed: 1\n')
375375

benchmark/scripts/test_compare_perf_tests.py

Lines changed: 8 additions & 2 deletions
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)