Skip to content

Commit 264b61d

Browse files
authored
Improve formatting in test/parse_benchmark_output.py (#18047)
New: ``` Node.js_no_stack_check Node.js_with_stack_check base64 1.000 0.972 conditionals 1.000 1.096 copy 1.000 1.003 corrections 1.000 0.982 corrections64 1.000 1.004 fannkuch 1.000 1.004 fasta_float 1.000 1.002 havlak 1.000 1.025 ifs 1.000 0.962 matrix_multiply 1.000 1.021 ``` Old: ``` Node.js_no_stack_check Node.js_with_stack_check base64 1.0 0.9715909090909092 conditionals 1.0 1.096219035202086 copy 1.0 1.0028841716658976 corrections 1.0 0.9817155149233665 corrections64 1.0 1.0042210283960094 fannkuch 1.0 1.004495825305074 fasta_float 1.0 1.001837993960877 havlak 1.0 1.0250723240115718 ifs 1.0 0.9619738238415282 matrix_multiply 1.0 1.0212443095599393 ```
1 parent e4f46f8 commit 264b61d

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

test/parse_benchmark_output.py

100644100755
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,20 @@
5454
for i in range(1, len(line)):
5555
line[i] = line[i] / base
5656

57+
col0_width = max(len(r[0]) for r in matrix)
58+
5759
# filter results
5860
result = []
59-
for line in matrix:
60-
if len(line) != len(matrix[0]):
61-
print('warning: not enough results, skipping line:', line[0])
61+
for i, row in enumerate(matrix):
62+
if len(row) != len(matrix[0]):
63+
print('warning: not enough results, skipping row:', row[0])
6264
else:
63-
result += ['\t'.join([str(x) for x in line])]
65+
line = '%*s ' % (col0_width, row[0])
66+
if i == 0:
67+
line += '\t'.join([str(x) for x in row[1:]])
68+
else:
69+
line += '\t'.join(['%.3f' % x for x in row[1:]])
70+
result.append(line)
6471

6572
# print results
6673
print()

0 commit comments

Comments
 (0)