forked from Imagelibrary/littlefs
scripts: Fixed names/lines falling out of sync in diff table renderers
As a convenience, -d/--diff in our measurement scripts hides entries that are unchanged by default. Unfortunately this was broken during a recent refactor that ended up filtering the line info but not the actual names. Instead of reverting the broken part of the refactor, I've just moved the filtering up to where we calculate the names. Hopefully this fixes the bug while also simplifying this messy chunk of a logic a bit.
This commit is contained in:
@@ -662,7 +662,15 @@ def table(Result, results, diff_results=None, *,
|
||||
diff_table = {
|
||||
','.join(str(getattr(r, k) or '') for k in by): r
|
||||
for r in diff_results or []}
|
||||
names = list(table.keys() | diff_table.keys())
|
||||
names = [name
|
||||
for name in table.keys() | diff_table.keys()
|
||||
if diff_results is None
|
||||
or all_
|
||||
or any(
|
||||
types[k].ratio(
|
||||
getattr(table.get(name), k, None),
|
||||
getattr(diff_table.get(name), k, None))
|
||||
for k in fields)]
|
||||
|
||||
# sort again, now with diff info, note that python's sort is stable
|
||||
names.sort()
|
||||
@@ -763,12 +771,6 @@ def table(Result, results, diff_results=None, *,
|
||||
diff_r = None
|
||||
else:
|
||||
diff_r = diff_table.get(name)
|
||||
if not all_ and not any(
|
||||
types[k].ratio(
|
||||
getattr(r, k, None),
|
||||
getattr(diff_r, k, None))
|
||||
for k in fields):
|
||||
continue
|
||||
lines.append(table_entry(name, r, diff_r))
|
||||
|
||||
# total
|
||||
|
||||
Reference in New Issue
Block a user