Skip to content

[benchmark] Finish Naming Convention Support #22726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions benchmark/Naming.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ benchmark is testing individual method on a concrete type.
````
⛔️ Dictionary2
✅ AngryPhonebook
✅ Dictionary.AnyHashable.String.update
✅ Array.append.Array.Int
✅ Dictionary.AnyHashable.String.update
````

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

````
✅ Array.append.Array.Int?
✅ Flatten.Array.Tuple4.for-in.reserved
✅ Bridging.NSArray.as!.Array.NSString
✅ Flatten.Array.Tuple4.for-in.Reserve
````

Note: Special characters that could be interpreted by the shell require escaping
Expand Down
2 changes: 1 addition & 1 deletion benchmark/scripts/Benchmark_Driver
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class BenchmarkDriver(object):
with open(log_file, 'w') as f:
f.write(output)

RESULT = '{:>3} {:<25} {:>7} {:>7} {:>6} {:>10} {:>6} {:>7} {:>10}'
RESULT = '{:>3} {:<40} {:>7} {:>7} {:>6} {:>10} {:>6} {:>7} {:>10}'

def run_and_log(self, csv_console=True):
"""Run benchmarks and continuously log results to the console.
Expand Down
6 changes: 3 additions & 3 deletions benchmark/scripts/compare_perf_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,9 @@ def _reset(self):
# Parse lines like this
# #,TEST,SAMPLES,MIN(μs),MAX(μs),MEAN(μs),SD(μs),MEDIAN(μs)
results_re = re.compile(
r'( *\d+[, \t]+[\w.]+[, \t]+' + # #,TEST
r'[, \t]+'.join([r'\d+'] * 2) + # at least 2...
r'(?:[, \t]+\d*)*)') # ...or more numeric columns
r'( *\d+[, \t]+[\w.\-\?!]+[, \t]+' + # #,TEST
r'[, \t]+'.join([r'\d+'] * 2) + # at least 2...
r'(?:[, \t]+\d*)*)') # ...or more numeric columns

def _append_result(self, result):
columns = result.split(',') if ',' in result else result.split()
Expand Down
8 changes: 4 additions & 4 deletions benchmark/scripts/test_Benchmark_Driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,10 @@ def mock_run(test):
self.assertEqual(log, header + csv_log)
self.assertEqual(
out.getvalue(),
' # TEST SAMPLES MIN(μs) Q1(μs)' +
' MEDIAN(μs) Q3(μs) MAX(μs) MAX_RSS(B)\n' +
' 3 b1 5 101 102' +
' 103 104 105 888\n' +
' # TEST SAMPLES MIN(μs)' +
' Q1(μs) MEDIAN(μs) Q3(μs) MAX(μs) MAX_RSS(B)\n' +
' 3 b1 5 101' +
' 102 103 104 105 888\n' +
'\n' +
'Total performance tests executed: 1\n')

Expand Down
10 changes: 8 additions & 2 deletions benchmark/scripts/test_compare_perf_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,14 +445,20 @@ class TestLogParser(unittest.TestCase):
def test_parse_results_csv(self):
"""Ignores uknown lines, extracts data from supported formats."""
log = """#,TEST,SAMPLES,MIN(us),MAX(us),MEAN(us),SD(us),MEDIAN(us)
34,BitCount,20,3,4,4,0,4
7,Array.append.Array.Int?,20,10,10,10,0,10
21,Bridging.NSArray.as!.Array.NSString,20,11,11,11,0,11
42,Flatten.Array.Tuple4.lazy.for-in.Reserve,20,3,4,4,0,4

Total performance tests executed: 1
"""
parser = LogParser()
results = parser.parse_results(log.splitlines())
self.assertTrue(isinstance(results[0], PerformanceTestResult))
self.assertEqual(results[0].name, 'BitCount')
self.assertEquals(results[0].name, 'Array.append.Array.Int?')
self.assertEquals(results[1].name,
'Bridging.NSArray.as!.Array.NSString')
self.assertEquals(results[2].name,
'Flatten.Array.Tuple4.lazy.for-in.Reserve')

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