Commit 2c6bcc4
tests/ftests: speed up is_output_same() line compare loop
is_output_same() used to call expected_out.splitlines() on every
iteration and index into the freshly built list. Switching to
enumerate(zip(out_lines, exp_lines)) lets us split both strings once
and walk the pairs directly.
A quick timeit run (1,000,000 iterations with matching output) shows
the new loop shaving ~5% off the runtime:
old: 0.18783240672200918
new: 0.1784688732586801
While tiny in absolute terms, this removes needless allocations and
makes the helper more future-proof.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>1 parent 9bd62ff commit 2c6bcc4
1 file changed
+7
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
97 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
98 | 101 | | |
99 | 102 | | |
100 | | - | |
| 103 | + | |
101 | 104 | | |
102 | 105 | | |
| 106 | + | |
103 | 107 | | |
104 | 108 | | |
105 | 109 | | |
| |||
0 commit comments